Skip to content

Vocab data v2 #316

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

Merged
merged 12 commits into from
Aug 25, 2022
Merged

Vocab data v2 #316

merged 12 commits into from
Aug 25, 2022

Conversation

gregsdennis
Copy link
Collaborator

Resolves some conversations with @handrews in the JSON Schema Slack workspace.

Change summary:

  • instances are now referenced using either plain or relative JSON Pointers
  • schema data is now referenced using JSON Pointer fragments without needing to specify the full URI

This brings data resolution in closer alignment with $ref (and potentially solves some other issues.

@github-actions github-actions bot added documentation Improvements or additions to documentation pkg:schema-data try-me-site labels Aug 12, 2022
@github-actions
Copy link

github-actions bot commented Aug 12, 2022

Unit Test Results

     11 files  ±  0       11 suites  ±0   7s ⏱️ ±0s
7 758 tests +12  7 747 ✔️ +12  11 💤 ±0  0 ±0 
7 839 runs  +12  7 828 ✔️ +12  11 💤 ±0  0 ±0 

Results for commit 9e9c749. ± Comparison against base commit 8b05018.

♻️ This comment has been updated with latest results.

Copy link

@handrews handrews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this is a great change. I have some comments/suggestions around the fine points of URI and media type usage, and on how certain error cases can or can't be detected.

@gregsdennis
Copy link
Collaborator Author

gregsdennis commented Aug 17, 2022

With the latest edits, I have a few more changes to make to the implementation.

  • Add a data registry
  • Update the data fetch to not fetch by default
  • Still need to fix (and probably expand) the tests
  • Maybe need an interoperable test suite? (might be good for a separate PR)

Copy link

@handrews handrews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few more comments and nitpicks, but nothing that would be considered blocking even if accepted. I'm excited to see this!

- [Relative JSON Pointers](https://json-schema.org/draft/2019-09/relative-json-pointer.html)
- URI references per [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986), potentially with JSON Pointer fragments
- URI-encoded JSON Pointer identifier per [RFC 6901, §6](https://www.rfc-editor.org/rfc/rfc6901#section-6)
- Absolute URIs per [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986), optionally with a JSON Pointer fragment identifier

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: by definition, absolute URIs do not have fragments. I think the language we use in the JSON Schema spec is "full URI (with scheme)".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"with" here means "additionally"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reworded

- [Relative JSON Pointers](https://json-schema.org/draft/2019-09/relative-json-pointer.html)
- URI references per [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986), potentially with JSON Pointer fragments
- URI-encoded JSON Pointer identifier per [RFC 6901, §6](https://www.rfc-editor.org/rfc/rfc6901#section-6)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If instead you say "fragment-only URI using URI-encoded JSON Pointers per..." then you can get rid of the statement about parsing order further down, because fragment-only URIs, full URIs, JPs, and RJPs do not overlap at all in syntax. Unless you're trying to support some non-fragment-only references? But that seems confusing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can make this update. The only catch is I am trying to support full URIs + JP fragments (https://example.com/data#/foo).

{ "format": "json-pointer" },
{ "format": "relative-json-pointer" }
{ "format": "relative-json-pointer" },
{ "format": "uri-reference" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add "pattern": "^#" to restrict this to fragment-only URIs if you go with that suggestion I made earlier.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a format for full (absolute) URI that could also include a JP fragment? I'd have to split out uri-reference to support "JP fragment URI" and "full URI with (+) optional JP fragment" as separate items (which is fine, but I'd have to do it).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've split this to iri and iri-reference-with-pattern.

(I've also updated to use IRI instead of URI.)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a format for full (absolute) URI that could also include a JP fragment?

@gregsdennis one of my many half-designed format-replacement vocabularies would be capable of this 🙃

Copy link

@handrews handrews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest changes look good!

@gregsdennis gregsdennis merged commit fc93e52 into master Aug 25, 2022
@gregsdennis gregsdennis deleted the vocab-data-v2 branch August 25, 2022 21:56
@gregsdennis gregsdennis added the json-everything.net Improvements or additions to the playground site label Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation json-everything.net Improvements or additions to the playground site pkg:schema-data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants