hypothesis-jsonschema
hypothesis-jsonschema copied to clipboard
Tools to generate test data from JSON schemata with Hypothesis
The following `jsonschema` provokes `hypothesis-jsonschema` to fail: ```py from hypothesis import given from hypothesis_jsonschema import from_schema schema = { "$schema": "http://json-schema.org/draft-04/schema#", "$defs": { "def_foo": { "properties": { "foo": {"type": "string"}...
Based on #61 but doesn't include explicit data generation for recursive references. I will update this comment with the results of different commits to track the progress in a more...
```python schema = { "not": { "anyOf": [ {"type": "null"}, {"type": "boolean"}, {"type": "number"}, {"type": "number", "multipleOf": 2.5}, ] } } ```
Currently, `hypothesis-jsonschema` basically just gives up if the schema has two overlapping regular expressions - at best, we'll try to randomly pick one to generate examples from, and use the...
I recently saw https://github.com/python/typing/issues/182#issuecomment-899624078 proposing a nice trick for type-checking JSON data, and it occured to me that this could be extended to define version-specific `Schema` types using [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict). See...
See https://github.com/Julian/jsonschema/blob/main/CHANGELOG.rst#v400 and update tests etc. to check for the (partially) supported Drafts 2020-12 and 2019-09. Also maybe the `False != 0` validation fix will allow some test skips or...
For example if `propertyNames` disallows a `required` name, we can return the empty schema; if a dependent name is disallowed we can drop that, etc.
Ran into this when I used a `Pydantic.BaseModel.schema()` as the argument to `from_schema`. Pydantic caches the schemas of its models, so this caused unexpected changes elsewhere. I think this happens...
As per [Draft 4](https://datatracker.ietf.org/doc/html/draft-fge-json-schema-validation-00#section-7) and [Draft 7](https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-7) validation docs: > A format attribute can generally only validate a given set of instance types. If the type of the instance to...
At the moment the "number" type corresponds to `st.float` strategy, but as integers are valid for the "number" type in JSON Schema, I am wondering whether it will make sense...