hypothesis-jsonschema
hypothesis-jsonschema copied to clipboard
Tools to generate test data from JSON schemata with Hypothesis
```python-traceback ____________ test_canonicalises_to_equivalent_fixpoint[any-schema] _____________ [gw0] linux -- Python 3.7.10 /home/runner/work/hypothesis-jsonschema/hypothesis-jsonschema/.tox/test/bin/python tests/test_canonicalise.py:27: in test_canonicalises_to_equivalent_fixpoint @given(data=st.data()) tests/test_canonicalise.py:33: in test_canonicalises_to_equivalent_fixpoint assert cc == canonicalish(cc) E AssertionError: assert {'not': {'min...g', 'object']} == {'type': ['nu...g',...
I really don't like references to other schemas, because they make the meaning temporally variable and unreliable - the referenced schema can change or become inaccessible. Dealing with them also...
The [`const` keyword was added in draft-06](https://json-schema.org/draft-06/json-schema-release-notes.html), and therefore has *no effect whatsoever* in draft-04 schemas. While authors probably *intended* to constrain the value somewhat, we still have to follow...
Take for example the following schema: ```json { "person": { "type": "object", "properties": { "name": {"type": "string"}, "parents": { "type": "array", "maxItems": 2, "items": {"$ref": "#/person"} } } }, "$ref":...
Currently the `test_canonicalises_to_equivalent_fixpoint` [test fails](https://github.com/Zac-HD/hypothesis-jsonschema/blob/master/tests/test_canonicalise.py#L45) on `assert cc == canonicalish(cc)` with the following schema: ```python schema = {'not': {'anyOf': [{'type': 'number'}, {'if': {'type': 'null'}, 'then': {'type': 'null'}, 'else': {}}]}} ```...
Every project with aspirations to greatness needs a logo, and `hypothesis-jsonschema` is no exception. Are you the generous designer who can help? - Hypothesmith is, as the name suggests, built...
Consider the schema `{"oneOf": [{"required": ["foo"]}, {"required": ["bar"]}]}` What values could match this? Because the two sub-schemas only constrain objects, all values of any other type will be valid against...
## Background `hypothesis-jsonschema` is basically just a function which maps a json schema to a Hypothesis strategy for generating instances which conform to that schema... and a few internal helpers....
[*Type Safety with JSON Subschema*](https://arxiv.org/abs/1911.12651) is a neat paper which explores similar canonicalization logic to hypothesis-jsonschema, and the implemenation is also in Python! Unfortunately there are keywords that they don't...
It occurs to me that having a jsonschema and wanting to test something is by no means limited to projects using Python, and we can pretty easily provide a useful...