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

Unhelpful error message: a JSON pointer should start with '/' or '#/' #51

Closed
wlk opened this issue Sep 7, 2016 · 2 comments
Closed

Comments

@wlk
Copy link

wlk commented Sep 7, 2016

I'm trying to test out this project but after loading my schema I got following exception:

An exception or error caused a run to abort: a JSON pointer should start with '/' or '#/' 
java.lang.IllegalArgumentException: a JSON pointer should start with '/' or '#/'
    at org.json.JSONPointer.<init>(JSONPointer.java:155)
    at org.everit.json.schema.loader.internal.JSONPointer.queryFrom(JSONPointer.java:183)
    at org.everit.json.schema.loader.internal.JSONPointer.query(JSONPointer.java:171)
    at org.everit.json.schema.loader.SchemaLoader.lookupReference(SchemaLoader.java:578)
    at org.everit.json.schema.loader.SchemaLoader.buildSchemaWithoutExplicitType(SchemaLoader.java:435)
    at org.everit.json.schema.loader.SchemaLoader.load(SchemaLoader.java:517)
    at org.everit.json.schema.loader.SchemaLoader.loadChild(SchemaLoader.java:530)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:250)
    at java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:110)
    at java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:693)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at org.everit.json.schema.loader.SchemaLoader.tryCombinedSchema(SchemaLoader.java:640)
    at org.everit.json.schema.loader.SchemaLoader.load(SchemaLoader.java:514)
    at org.everit.json.schema.loader.SchemaLoader.load(SchemaLoader.java:223)
    at org.everit.json.schema.loader.SchemaLoader.load(SchemaLoader.java:206)

(I think the actual contents of the schema is unimportant)

This is unhelpful for me because the message should include information where the problem is happening so I could fix it without manually looking at the schema

@wlk
Copy link
Author

wlk commented Sep 7, 2016

Also I think this requirement is invalid, the # is also allowed pointer value.

See: http://json-schema.org/draft-04/schema grep for:

"items": { "$ref": "#" }

@erosb
Copy link
Contributor

erosb commented Sep 9, 2016

Hello, thanks for reporting it. I would handle the JSON Pointer handling and the helpfulness of the exception message as two separate issues. The first one is a bug in the org.json library, so I will fix that bug in that project. The second one (making the schema loading failure reports more descriptive) is more a feature improvement than a bugreport, and also it will probably take more serious efforts to change.

@erosb erosb closed this as completed Jul 20, 2017
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