Replacing jsonschema.RefResolver with referencing.Registry
Closed this issue · 0 comments
SarahJohnsonONS commented
Results of the investigation into #854 as follows:
jsonschema.RefResolver
is currently being used in two places -models/jsonvalidationerrors.py
andutils/json.py
.- In
utils/json.py
,RefResolver
is used in the functionresolve_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 theAnyOneOfJsonSchemaValidationError
class. - Having installed the
referencing
package, some changes were made tomodels/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.