Closed Alexander-Serov closed 1 year ago
Same as @Alexander-Serov here, literally same problem and same temporary solution for now.
I can't fix or address anything without some code.
Looks like this commit is the cause. If I remove the "REMOVEME" code in validators.py
things seems to behave as expected. (Still investigating though.)
That is essentially the only commit in the release -- but come on folks, it's bug filing 101 -- you need to include some sort of code to reproduce what you're reporting here -- all tests in this package pass, so whatever you're running needs an example.
That is essentially the only commit in the release
Made it easy to find ;-p
That is essentially the only commit in the release -- but come on folks, it's bug filing 101
Sure. Like I mentioned above, still investigating. It is hard to dig into 5 levels of dependencies, in my case.
When doing:
pip install great-expectations==0.15.50 jsonschema==4.18.0
this line:
from great_expectations.checkpoint import SimpleCheckpoint
works. However, with:
pip install great-expectations==0.15.50 jsonschema==4.18.1
that same line fails and it says:
jsonschema.exceptions._RefResolutionError: 'bytes' object has no attribute 'timeout'
Fine on 4.18.0. Breaks on 4.18.1.
from jsonschema import Draft4Validator, RefResolver
class CustomRefResolver(RefResolver):
def __init__(self, *args, **kw):
super().__init__(*args, **kw)
def resolve_remote(self, uri):
return {}
schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"x": {
"$ref": "#/definitions/x"
},
"y": {
"$ref": "https://standard.open-contracting.org/schema/1__1__5/release-schema.json"
}
},
"definitions": {
"x": {"type": "string"}
}
}
list(Draft4Validator(schema, resolver=CustomRefResolver("", schema)).iter_errors({"x": 1}))
yields
jsonschema.exceptions._RefResolutionError: Unresolvable JSON pointer: 'definitions/x'
That is essentially the only commit in the release -- but come on folks, it's bug filing 101 -- you need to include some sort of code to reproduce what you're reporting here -- all tests in this package pass, so whatever you're running needs an example.
As I told you we would love to, but this is not our direct dependency :) So was hoping the others would contribute.
💪🏻 teamwork
Great, thanks for the example, should be fixed momentarily in 4.18.2.
Hi, as reported by @jpmckinney in https://github.com/python-jsonschema/jsonschema/issues/1124#issuecomment-1632574249 I'm also getting
jsonschema.exceptions._RefResolutionError: Unresolvable JSON pointer: 'definitions/assets'
The error is happening for a pretty large FastAPI application but I'll try to deep dive to create a reproductible example (https://github.com/developmentseed/titiler/actions/runs/5529545166/jobs/10087758840)
This is happening for 4.18.1 and for the newest 4.18.2
Edit: This is all coming from one of our dependency https://github.com/stac-utils/pystac/issues/1186
Also running into the "Unresolvable JSON pointer" error for 4.18.2.
I'm using a custom yaml ref resolver and validating using the Draft202012Validator
.
self = <func.utils.YamlRefResolver object at 0x7f4215e01720>
document = {'$id': 'http://json-schema.org/draft-07/schema#', '$schema': 'http://json-schema.org/draft-07/schema#', 'default': Tr...'type': 'array'}, 'simpleTypes': {'enum': ['array', 'boolean', 'integer', 'null', 'number', 'object', ...]}, ...}, ...}
fragment = 'components/schemas/PipelineElement'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip("/")
if not fragment:
return document
if document is self.referrer:
find = self._find_in_referrer
else:
def find(key):
yield from _search_schema(document, _match_keyword(key))
for keyword in ["$anchor", "$dynamicAnchor"]:
for subschema in find(keyword):
if fragment == subschema[keyword]:
return subschema
for keyword in ["id", "$id"]:
for subschema in find(keyword):
f"Unresolvable JSON pointer: {fragment!r}",
)
E jsonschema.exceptions._RefResolutionError: Unresolvable JSON pointer: 'components/schemas/PipelineElement'
What's strange is that it seems to be searching for the fragment in the Draft-7 meta schema document instead of my local OpenAPI spec document and I'm not even using Draft-7.
Here is the traceback. I believe something has changed in the fresh release 4.18.1 from today because our CI pipeline stopped working, the code has not be changed.
I cannot provide the minimal working example since
jsonschema
is not our direct dependency but is rather used by Great Expectations. Still, the traceback clearly suggest there is a difference in howjsonschema
is implemented.We downgraded back to 4.17.* and it fixes the problem.