Skip to content

Conversation

@SubhraBNayak
Copy link

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.

@SubhraBNayak
Copy link
Author

Hi! 👋

I’m new to contributing here and still learning my way around the codebase.
This PR addresses the deprecation of jsonschema.RefResolver by replacing it with the referencing.Registry + referencing.Resource approach, as suggested in the docs.

I’ve tested the changes to ensure validation works the same as before.
Would appreciate any feedback or suggestions for improvement — I’m here to learn and happy to make adjustments.

Thanks for your time and for maintaining this project! 🙏

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.

1 participant