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

Replacing jsonschema.RefResolver with referencing.Registry #879

Closed
SarahJohnsonONS opened this issue Aug 25, 2023 · 0 comments
Closed

Replacing jsonschema.RefResolver with referencing.Registry #879

SarahJohnsonONS opened this issue Aug 25, 2023 · 0 comments

Comments

@SarahJohnsonONS
Copy link
Contributor

SarahJohnsonONS commented Aug 25, 2023

Results of the investigation into #854 as follows:

  • jsonschema.RefResolver is currently being used in two places - models/jsonvalidationerrors.py and utils/json.py.
  • In utils/json.py, RefResolver is used in the function resolve_path - however, this does not appear to be used anywhere in the codebase - when commented out, all unit and behaviour tests still pass.
  • In models/jsonvalidationerrors.py, RefResolver is used in the functions _child_error_messages_display_string and _resolve_reference_in_schema of the AnyOneOfJsonSchemaValidationError class.
  • Having installed the referencing package, some changes were made to models/jsonvalidationerrors.py (see branch).
  • The referencing library documentation on migrating from RefResolver was followed, and some use cases have been implemented.
  • The main issue that needs to be resolved is accommodating $ref values that are URIs - see the comments in models/jsonvalidationerrors.py L191-198 in the branch linked above. As noted, this is an issue for inline codelists, but there may be other examples that have not yet been identified.

Further spike/investigation on this issue:

  • What would happen if we removed this functionality? What impact does it have and is there another way that can avoid using this method?
  • Try finding other open source projects that have dealt with this deprecation issue, closed issues on GitHub.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants