-
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
Use JSON Pointer for ValidationMessage.path() #58
Comments
@ehrmann It is JSONPath format and I think it is more powerful than JSON Pointer at the moment. In my light-bot project I am building test integration test cases and use JSON Path to assert the error messages. There is no RFC for JSONPath but I think it is used more often than JSON Pointer at the moment. In my opinion, we should support both and let end user to choose which format they want in the ValidationMessage. To ensure that the current users won't be impacted, let's make the JSONPath as default. Here is a link that is discussing these two. https://www.tbray.org/ongoing/When/201x/2017/04/14/JsonPath-Needs-Work |
Supporting both is reasonable enough. The only thing with JSONPath is that you don't actually need the flexibility here. Validation errors happen on nodes that can be accessed just by index and property. Index slicing, relative paths, and filters don't help much, here. That's also the reason JSON Pointer hasn't seen much use; it doesn't really do much. |
Currently, paths are built in a format like
$.foo.bar[0]
. It's almost likejq
, but not quite.What are your thoughts on using an RFC-6901 JSON Pointer instead? The format looks more like
/foo/bar/0
. It's supported out-of-the-box by Jackson, and it resolves ambiguities with characters like[
and.
being in field names.It's something I can open a PR for, but I wanted to ask your opinion before doing the work.
The text was updated successfully, but these errors were encountered: