Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema with $ref in spring resource file and NPE #23

Closed
Jacuo opened this issue Jul 12, 2016 · 2 comments
Closed

Schema with $ref in spring resource file and NPE #23

Jacuo opened this issue Jul 12, 2016 · 2 comments

Comments

@Jacuo
Copy link

Jacuo commented Jul 12, 2016

  1. I have my schema file in src/main/resources
  2. In schema i have construction like "$ref": "#/definitions/deleteSchema"
  3. I open schema
    ResourceLoader resourceLoader ;
    ....
    Json.Schema schema = Json.schema(resourceLoader.getResource("classpath:" + jsonSchemaFile).getURI());
  4. I have NPE
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
        at mjson.Json$DefaultSchema.<init>(Json.java:1009) ~[mjson-1.3.jar:na]
        at mjson.Json.schema(Json.java:1035) ~[mjson-1.3.jar:na]
        ... 48 common frames omitted
Caused by: java.lang.NullPointerException: null
        at mjson.Json.resolveRef(Json.java:462) ~[mjson-1.3.jar:na]
        at mjson.Json.expandReferences(Json.java:508) ~[mjson-1.3.jar:na]
        at mjson.Json.expandReferences(Json.java:529) ~[mjson-1.3.jar:na]
        at mjson.Json.expandReferences(Json.java:519) ~[mjson-1.3.jar:na]
        at mjson.Json$DefaultSchema.<init>(Json.java:1006) ~[mjson-1.3.jar:na]
@bolerio
Copy link
Owner

bolerio commented Jul 12, 2016

Can you give me complete schema files that reproduce the problem. It'll save me some time to debug. Also, are you using 1.3 stable or 1.4 snapshot?

@bolerio
Copy link
Owner

bolerio commented Aug 23, 2016

I just added a test with this case (see src/test/resources/schema_with_defs.json) and the unit test in TestSchemas.java

It seem to be working some I'm closing this as working. If you have a use case that shows the problem with the latest code, let's look at it!

@bolerio bolerio closed this as completed Aug 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants