json-schema-org / JSON-Schema-Test-Suite

A language agnostic test suite for the JSON Schema specifications
MIT License
615 stars 205 forks source link

test: percent-encoded char in json-pointer #650

Closed santhosh-tekuri closed 1 year ago

santhosh-tekuri commented 1 year ago

from https://www.rfc-editor.org/rfc/rfc6901#section-6:

   A JSON Pointer can be represented in a URI fragment identifier by
   encoding it into octets using UTF-8 [[RFC3629](https://www.rfc-editor.org/rfc/rfc3629)], while percent-encoding
   those characters not allowed by the fragment rule in [[RFC3986](https://www.rfc-editor.org/rfc/rfc3986)].

test passed with impl https://github.com/santhosh-tekuri/boon

if test is ok, will add to remaining drafts

gregsdennis commented 1 year ago

This looks fine to me. My only question is whether the JSON Schema Test Suite should test JSON Pointer things.

karenetheridge commented 1 year ago

whether the JSON Schema Test Suite should test JSON Pointer things

Testing that the URI fragment is properly parsed into the underlying json pointer seems a very relevant thing to me.

[Tests pass over here; thanks!]

karenetheridge commented 1 year ago

There's a bunch of similar tests here of various characters that are encoded in json pointers and in URIs (or both); these could be adapted to the form used by the test suite, but some are more suited to testing result output, as there's only so much you can test with just an expected valid/invalid response.

https://github.com/karenetheridge/JSON-Schema-Modern/blob/v0.564/t/errors.t#L1012-L1142

santhosh-tekuri commented 1 year ago

my intentioned is not have a test for each reserved char. I just want to test that an implementation percent-decodes the raw fragment before using

jdesrosiers commented 1 year ago

This case is already tested here (see "percent%field"). I'm going to close this as a duplicate.