-
Notifications
You must be signed in to change notification settings - Fork 324
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
Documenting ValidationMessage.path format #401
Comments
@chuwy The JSON schema spec team seems to be moving to the JSONPointer these days and it gave a lot of headache for the implementation teams. Personally, I would prefer the JsonPath syntax but wondering if we should follow the direction from the spec team. https://json-schema.org/draft/2019-09/relative-json-pointer.html |
Yup, that's one more point. Basically, I see pros as:
The only con I see is that it's less powerful, but again I don't think anyone ever needs the query power of JSONPath in validator. Also, do you mind confirm my hypothesis that json-schema-validator only produces those simple kinds of |
Yes. I can confirm that we only use simple paths. There are several issues opened trying to address the issue that context is not very clear in the path when nested schemas are used. |
Hello there!
This is both a question and a proposal (although duplicate of #58).
I'm assuming
json-schema-validator
would not produceValidationMessage
s withpath
properties following the most exotic JSONPath features such as$..book[-1:]
,$..book[?(@.price<10)]
etc. In my experience the library provides the most basic pointers like:$.book.title
$.books[2].title
Which kind of make sense since things like
$..book[-1:]
exist for querying data (so we don't know what's in the target JSON). And the Validator only points to data (we do know what and where we want to point to).The question: is there anything that would confirm my hypothesis about only most basic types of JSONPath supported by the Validator? I couldn't find anything in the test suite because it's mostly about validation and has nothing about paths. I'm asking because I'm writing a small parser for
ValidationMessage.path
and would like to know how far should I go with JSONPath implementation. Are there any additional constructs I need to be aware of?The proposal (more as food for thoughts obviously): I agree with @ehrmann on #58 (comment). JSONPath is very powerfull, but with great power comes great responsibility and I don't think that the Validator needs it. Writing a parser for super simple JSON Pointer is a piece of cake even when I want 100% features coverage, writing a parser for JSONPath is almost like writing a parser for a programming language with tons of undodocumented features and corner cases.
The text was updated successfully, but these errors were encountered: