fixed RefResolver deprecation warnings #430
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR closes #(373)
##What I changed
Replaced usage of jsonschema.RefResolver (deprecated in jsonschema v4.10.0) with the new referencing.Registry and referencing.Resource approach.
##Updated:
validate() method in the main code to build a Registry with the schema’s base URI and contents.
Corresponding test in tests/schemata/test_import_schema.py to validate using the Registry instead of RefResolver.
Added encoding="utf-8" when opening JSON schema files to ensure consistent cross-platform behavior.
##Why I changed it
RefResolver is deprecated and may be removed in future jsonschema releases.
Migrating to the referencing library ensures future compatibility and removes deprecation warnings.
Keeps Open Library’s client code aligned with modern jsonschema best practices.
##How I tested it
Ran the existing test suite, including tests/schemata/test_import_schema.py.
Verified all schema validations pass without deprecation warnings.
Confirmed that document validation behavior is identical before and after the change.