Closed viraptor closed 2 years ago
Hi. This might be an incompatibility with some recent jsonschema. What is the jsonschema version you are using?
jsonschema-4.16.0
- latest version.
Tested previous versions and 4.9.0
is the first one that fails the tests (up till latest). Versions < 4.9.0
pass everything.
If it helps, after bisecting, this is the commit in jsonschema which breaks the tests: https://github.com/python-jsonschema/jsonschema/commit/c9a3667507be5ba75fbf57589cbf094e881625af
I've looked a bit into the failure of the test_reference_in_meta
test.
The resolver's base_uri
isn't getting set, because in the test we have id
and $ref
on the base level and in that case id
gets ignored.
meta_schema = {
'id': 'http://example.com/schema_1.json',
'$ref': 'schema_2.json#/definitions/meta'
}
This is as per id_of_ignore_ref()
used in the old Draft4Validator
, which is still the default in jsonmerge. This behavior was introduced in https://github.com/python-jsonschema/jsonschema/commit/bf92aed44eb317188fba68e558d0429c68259dee and first released in jsonschema 4.15.0.
Since $ref
is a relative URI and there is no base_uri
, the resolve fails. The test works if $ref
is a full URI.
There are some other test failures related to reference resolution that appear and disappear with other jsonschema 4.x releases, which might be the reason why your bisect arrived at a different commit.
It's been a while since I looked at this code and I can't remember what use case this test was trying to test in the first place. At the moment it seems to me that it shouldn't have worked at all. I also see there's already a comment in the resolve_subschema_option_refs
method that this test hits that the code is kind of dodgy.
I need to think some more about this.
This issue should be fixed now. Can you check if it works for you?
When trying the tests on v1.8.0 with python 3.10 on darwin-intel, I get the following failure: