-
Notifications
You must be signed in to change notification settings - Fork 128
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 jsonschema ≥4.18.0 and new referencing library #1691
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1691 +/- ##
=======================================
Coverage 72.30% 72.30%
=======================================
Files 79 79
Lines 8276 8276
Branches 1691 1691
=======================================
Hits 5984 5984
Misses 2007 2007
Partials 285 285 ☔ View full report in Codecov by Sentry. |
Thanks, @victorlin! I love an improvement that's +5 lines and -14 😄 Just adding a note here for our own reference that we'll need to add |
0292963
to
2e8fc63
Compare
2e8fc63
to
9e33b0e
Compare
8b3e456
to
67ada11
Compare
86a23c1
to
26a76f9
Compare
In v4.18.0, jsonschema.RefResolver was deprecated in favor of the new referencing library.¹ The intro² and API³ docs were helpful in determining the necessary changes. I've tested that our new usage is not backwards compatible with v4.17.3 and thus updated the minimum requirement to v4.18.0. I chose v0.29.1 as the minimum supported version of referencing because that was the version released alongside jsonschema v4.18.0. The default behavior no longer tries to access the network, so I've reworded the retrieval function comment and error message. Local reference mismatches are now a "PointerToNowhere" error instead of an "Unresolvable JSON pointer" error. It shows the entire schema JSON in the output which can seem unnecessarily verbose, but I think it's fine since this is only intended to show on internal errors with the schema. ¹ https://github.com/python-jsonschema/jsonschema/blob/93e0caa5752947ec77333da81a634afe41a022ed/CHANGELOG.rst#v4180 ² https://python-jsonschema.readthedocs.io/en/stable/referencing/#introduction-to-the-referencing-api ³ https://referencing.readthedocs.io/en/stable/api/#referencing.Registry.with_contents
26a76f9
to
901fcc8
Compare
Description of proposed changes
In v4.18.0, jsonschema.RefResolver was deprecated in favor of the new referencing library. The intro and API docs were helpful in determining the necessary changes.
I've tested that our new usage is not backwards compatible with v4.17.3 and thus updated the minimum requirement to v4.18.0. I chose v0.29.1 as the minimum supported version of referencing because that was the version released alongside jsonschema v4.18.0.
The default behavior no longer tries to access the network, so I've reworded the retrieval function comment and error message.
Local reference mismatches are now a "PointerToNowhere" error instead of an "Unresolvable JSON pointer" error. It shows the entire schema JSON in the output which can seem unnecessarily verbose, but I think it's fine since this is only intended to show on internal errors with the schema.
Related issue(s)
Closes #1358
Checklist