-
-
Notifications
You must be signed in to change notification settings - Fork 607
Description
While running tests on https://pagure.io/fedora-qa/os-autoinst-distri-fedora , I noticed a deprecation warning:
/home/adamw/local/os-autoinst-distri-fedora/fifloader.py:105: DeprecationWarning: jsonschema.RefResolver is deprecated as of v4.18.0, in favor of the https://github.com/python-jsonschema/referencing library, which provides more compliant referencing behavior as well as more flexible APIs for customization. A future release will remove RefResolver. Please file a feature request (on referencing) if you are missing an API for the kind of customization you need.
resolver = jsonschema.RefResolver(base_uri, None)
So I went to look at the docs to try and resolve it. All we are doing is using a RefResolver which specifies a local file path to resolve references: the project has a directory with a bunch of schema files in it, and some of them reference others of them. All I need is for jsonschema.validate to know that it should just look in the same directory when resolving these references, so all we do is find that directory and pass it as the first argument to the RefResolver instance.
The deprecation notice points me to https://github.com/python-jsonschema/referencing , which explains the referencing library in great detail but really doesn't help me figure out how the heck to use it to replace this very simple RefResolver usage. Googling around brings me to https://python-jsonschema.readthedocs.io/en/latest/referencing/ , which likewise goes into a ton of confusing detail on other scenarios but doesn't seem to provide any obvious help for mine. It even has a "Migrating from RefResolver" section, which also does not seem to cover this scenario at all.
It'd be great if any of these docs helped me figure out how to survive this deprecation :| thanks a lot!