-
-
Notifications
You must be signed in to change notification settings - Fork 574
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
Validating a deeply nested schema using custom "strict" draft 2020 metaschema can be very slow #1097
Comments
Hey! Did you mean to file this on the check-jsonschema repo? If not, can you minimize to something that doesn't go via the CLI? |
I thought that check-jsonschema uses jsonschema internally, and that this problem is most likely a bug in jsonschema. |
I didn't insist -- or tell you to move it, I said if you think it's a likely jsonschema bug, please minimize your example :) |
Can/should we reopen this? I don't really know what to do with the CLI ticket until/unless we determine that it is not a I've pulled down the schema and instance the user provided and validated that this does at least run for a long time for me -- 6 minutes -- but that it terminates and in fact succeeds. Just using the CLI -- I don't have time to try harder to give a python-only repro this minute -- I was able to reproduce a slow validation pass by trimming the user's schema down to the following document: {
"type": "object",
"properties": {
"body": {
"type": "object",
"properties": {
"config": {
"type": "object",
"properties": {
"global": {
"type": "object",
"properties": {
"uitranslation": {
"type": "object",
"properties": {
"country": {
"type": "array",
"items": {
"type": "object",
"properties": {
"language": {
"type": "array",
"items": {
"type": "object",
"properties": {
"entries": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
} and the metaschema from that thread was this: {
"$id": "https://example.com/draft/2020-12/schema/strict",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/core": true,
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
"https://json-schema.org/draft/2020-12/vocab/validation": true,
"https://json-schema.org/draft/2020-12/vocab/meta-data": true,
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
"https://json-schema.org/draft/2020-12/vocab/content": true
},
"$dynamicAnchor": "meta",
"$ref": "https://json-schema.org/draft/2020-12/schema",
"unevaluatedProperties": false
} For me, on |
The example here seems to complete in around ~1 second on my machine on 4.18.3. I'm going to call whatever was happening here fixed via the performance optimizations that went in with the |
I am using
check-jsonschema
0.23.0 with jsonschema 4.17.3 to validate a JSON schema against a strict json schema schema.When running check-jsonschema, it runs for at least a minute until I kill it. Looks like an infinite loop somewhere.
Validating against the "normal" json schema schema works.
The schema I am validating against is this: https://github.com/orgs/json-schema-org/discussions/380#discussioncomment-5711007
The schema file I am writing (and which was generated by
genson
) is attached here: api-rest-connect-stick-stick-xxx.schema.json.gzThe text was updated successfully, but these errors were encountered: