[MODCXMOCK-11] Cannot intialize query validation Created: 20/Dec/17  Updated: 12/Jun/20  Resolved: 12/Jun/20

Status: Closed
Project: mod-codex-mock
Components: None
Affects versions: 1.0.1
Fix versions: None

Type: Bug Priority: P4
Reporter: Heikki Levanto Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: back-end, triaged
Remaining Estimate: Not Specified
Time Spent: 1 hour
Original estimate: Not Specified

Issue links:
Relates
relates to RMB-103 Schema dereferencing doesn't work if ... Closed
Sprint:

 Description   

"unable to load schema" - no apidocs directory created in /target/classes



 Comments   
Comment by Heikki Levanto [ 20/Dec/17 ]

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.

Comment by Heikki Levanto [ 20/Dec/17 ]

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.

Comment by Heikki Levanto [ 20/Dec/17 ]

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.

Comment by Jakub Skoczen [ 12/Jun/20 ]

Closing as outdated. Re-open if needed.

Generated at Thu Feb 08 22:26:45 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.