-
Notifications
You must be signed in to change notification settings - Fork 66
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
Escape JSON pointer tokens #122
Conversation
When building `data_pointer` and `schema_pointer` in error objects. [JSON Pointer RFC][0]: ``` Because the characters '~' (%x7E) and '/' (%x2F) have special meanings in JSON Pointer, '~' needs to be encoded as '~0' and '/' needs to be encoded as '~1' when these characters appear in a reference token. ``` Fixes: #121 [0]: https://www.rfc-editor.org/rfc/rfc6901#section-3
@davishmcclurg This breaks when the token is not a string, for example a boolean |
@eraffel-MDSol do you mind providing an example that I can test with? |
Ok, correction, the issue is when the key is a boolean. I guess my question is this, since the library is accepting a hash, should it do the conversion from Regardless, I would assume you don't want to throw an exception, so there should be a check that the key is a string, right? |
@davishmcclurg Any thoughts on the above? |
For reference:
Hmm, good question. I think ideally the caller should be responsible for that since this library assumes
There's also the issue of referencing non-string keys in schemas. JSON schemas don't allow non-string
A valid JSON schema can only target the string version. That said, this is a change in behavior and calling |
When building
data_pointer
andschema_pointer
in error objects.JSON Pointer RFC:
Fixes: #121