New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RecursionError when validating schema with anyOf and draft 2019-09 #847
Comments
Hi there. This probably indeed is a bug, but just to clarify, you mean you created a new example different than the one you had previously been using correct? jsonschema 3.2.0 didn't support draft2019-09, so the schema you have here wouldn't have done anything on that version. |
I didn't realize that draft 2019-09 was not supported on 3.2.0. We have been using that combination for a while, and presumably the metaschema was being ignored. The Our actual project contains a lot more in the instance and schema, and gets the data for both from yaml files. When posting this issue, I cut out everything that what was not required to reproduce the error. I have tried a few different versions (with both the cut down code posted here, and our full project), and looks like this issue only occurs with |
FWIW, I'm seeing what appears to be the same problem if using draft 2019-09 meta-schema. |
@robherring does your schema use "anyOf"? |
@Zeckie Yes, it does. I would think the problem exists for other cases as well. 'allOf' has the same meta-schema for example. |
Facing the same issue with a known working schema/instance pair. In my case, the schema contains a |
Given that this ( If someone cares to send one that deletes the body of the implementation alongside a test that exercises this case, as I say, it'd certainly be welcome. |
I suppose https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#appendix-C tree example couldn't be validated with the same error? |
* Pinned jsonschema to 3.2.0 to solve a serious issue with the interaction between bravado core and jsonschema (see: python-jsonschema/jsonschema#847) * Fixed a bug in the order of route handling when it is desired to serve the UI and to allow subpaths in the Swagger API that aren't strictly defined by the specification.
…used with newer versions of jsonschema (4.0.0+); this seems to be a problem with jsonschema itself (python-jsonschema/jsonschema#847). This commit pins jsonschema to the last known compatible version for bravado-core until the upstream issue is addressed.
Just to chip in on this - does the issue occur with the Draft Using the latest version of the package, namely v4.4.0 seems to... work without crashing...? from jsonschema.validators import validate
# this is OK...?
validate(
instance={"foo": "bar"},
schema={
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [{"type": "object"}],
},
)
# this exhibits the error described in the thread.
validate(
instance={"foo": "bar"},
schema={
"$schema": "https://json-schema.org/draft/2019-09/schema",
"anyOf": [{"type": "object"}],
},
) Can anyone confirm this behavior? |
Yes. I was hit by this last week and just found out about this issue. |
Facing the same issue in version 4.3.1 and 4.5.1, using |
As I mentioned: |
NixOS 22.05 does have a newer version of jsonschema that has issues with the `anyOf` node that we are using the schema.json. Since the `anyOf` node seems to be part of some draft that isn't fully supported there isn't an upstream fix just yet. The upstream `jsonschema` bug is being tracked here: python-jsonschema/jsonschema#847
A python project i'm working on recently started failing with a RecursionError. We are using jsonschema to validate quite a complex yaml file, but i've been able to cut that down to few lines.
Issue occured when using jsonschema==4.0.1 on Python 3.9.6, but did not occur with jsonschema==3.2.0
Gives:
The text was updated successfully, but these errors were encountered: