Cannot intialize query validation
Description
CSP Request Details
CSP Rejection Details
Potential Workaround
relates to
Checklist
hideTestRail: Results
Activity
Jakub SkoczenJune 12, 2020 at 10:51 AM
Closing as outdated. Re-open if needed.
Heikki LevantoDecember 20, 2017 at 12:05 PM
There is a test case in MockTest that demonstrates this, a query like ?query=BADFIELD=foo
succeeds with 200 and gets no hits, instead of failing with 422. The test result is commented out, so all tests pass.
Heikki LevantoDecember 20, 2017 at 11:55 AM
Throwing a null pointer exception is probably not the best way to handle this situation, a more meaningful error message could at least say that it could not load the resource.
Heikki LevantoDecember 20, 2017 at 11:51 AM
Probably something to do with the fact that I don't have my own raml or schemas at all, they all come from raml-utils.
I have this property in my pom.xml:
<ramlfiles_path>${basedir}/ramls/raml-util/ramls/codex</ramlfiles_path>
since that's where the codex.raml is located.
Trying to load the schema fails with
SEVERE: unable to load schema - apidocs/raml/codex.json, validation of query fields will not be active
java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:78)
at java.io.InputStreamReader.<init>(InputStreamReader.java:97)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1077)
at org.apache.commons.io.IOUtils.toString(IOUtils.java:382)
at org.folio.rest.impl.CodexMockImpl.initCQLValidation(CodexMockImpl.java:60)
at org.folio.rest.impl.CodexMockImpl.<init>(CodexMockImpl.java:70)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.folio.rest.RestVerticle.route(RestVerticle.java:398)
at org.folio.rest.RestVerticle.lambda$12(RestVerticle.java:253)
Which is kind of fair enough, since there is no file at apidocs/raml/codex.json
. Actually, the whole apidocs directory is missing.
"unable to load schema" - no apidocs directory created in /target/classes