Skip to content
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

Remove deprecated RefResolver jsonschema validataion #51

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

Geary-Layne
Copy link
Contributor

Linear - 522

As of jsonschema 4.18 (I think) the use of RefResolver has been deprecated in preference of Registry. There is very little code changes here, and all within one file.

Note: This code requires jsonschema to be version 4.21 (or beyond) and a new package 'referencing'. I installed both with pip.

Copy link
Contributor

@mackenzie-grimes-noaa mackenzie-grimes-noaa left a comment

Choose a reason for hiding this comment

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

I read through the jsonschema docs and was pretty lost with all the resources, references, and registries. Thanks for updating this.

from jsonschema.protocols import Validator
from referencing import Registry
from referencing.jsonschema import DRAFT202012
Copy link
Collaborator

Choose a reason for hiding this comment

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

referencing is standard python package yeah?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As standard as json and jsonschema.

Copy link
Contributor

Choose a reason for hiding this comment

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

The docs weren't super clear, but referencing is technically a 3rd-party library that gets installed along with jsonschema when you run pip install jsonschema. So we should already have it.

(Source: pyproject.toml file from jsonschema).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks fro the clarification. Locally I had an old jsonschema, so I directly installed referencing, and later had realized I had to update jsonschema, so I didn't know they came together, or that referencing was a third party. But this does explain why the code worked on github.

Copy link
Collaborator

@rabellino-noaa rabellino-noaa left a comment

Choose a reason for hiding this comment

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

I don't think the changes in imports will have an impact on the builds (famous last words)

@Geary-Layne Geary-Layne merged commit 814dcd5 into main Jan 26, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants