-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Error resolving sub-schema property with type object or array #97
Comments
|
It is a Draft 4 schema. We can see that import jsonschema
from hypothesis_jsonschema import from_schema
schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$defs": {
"foo": {
"type": "object",
"properties": {"a": {"type": "string"}},
"additionalProperties": False
},
},
"allOf": [
{"$ref": "#/$defs/foo"},
],
}
jsonschema.validate({"a": "asdf"}, schema)
strategy = from_schema(schema)
print(strategy.example()) Executing the previous example outputs:
|
I have updated the description with a schema containing the Draft version. I have realized that that schema seems to be not 100% correct as: jsonschema.validate({"bar": {"foo": "asdf"}}, schema) # valid
jsonschema.validate({"bar": [{"foo": "asdf"}, {"foo": "asdf"}]}, schema) # valid
jsonschema.validate({"bar": ["0", 1]}, schema) # invalid The last validation should raise, but it doesn't. This could mean that is schema is not fully correct, but From a We define an object and an array together In |
The following
jsonschema
provokeshypothesis-jsonschema
to fail:Exception:
Environment:
Python version: 3.10.4
hypothesis==6.47.0
hypothesis-jsonschema==0.22.0
jsonschema==4.6.0
The text was updated successfully, but these errors were encountered: