Skip to content

Commit

Permalink
Remove unused resolve_remote overload
Browse files Browse the repository at this point in the history
I renamed $defs.tree to something else in schema-export-v2.json,
expecting this to error to be raised. Instead, I got an "Unresolvable
JSON pointer" error (tested on jsonschema v3.0.0 and v3.2.0). I'm not
sure what could trigger this exception, but it doesn't seem to be used
for its intended purpose.

Removing it in advance of supporting jsonschema v4.18.0, where this is
no longer applicable since schema_validator.resolver uses the deprecated
RefResolver.
  • Loading branch information
victorlin committed Dec 5, 2024
1 parent e90383b commit 4088b0d
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions augur/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ def load_json_schema(path, refs=None):
else:
schema_validator = Validator(schema)

# By default $ref URLs which we don't define in a schema_store are fetched
# by jsonschema. This often indicates a typo (the $ref doesn't match the key
# of the schema_store) or we forgot to add a local mapping for a new $ref.
# Either way, Augur should not be accessing the network.
def resolve_remote(url):
# The exception type is not important as jsonschema will catch & re-raise as a RefResolutionError
raise Exception(f"The schema used for validation attempted to fetch the remote URL {url!r}. " +
"Augur should resolve schema references to local files, please check the schema used " +
"and update the appropriate schema_store as needed." )
schema_validator.resolver.resolve_remote = resolve_remote

return schema_validator


Expand Down

0 comments on commit 4088b0d

Please sign in to comment.