A library that does exactly this is hypothesis-jsonschema
Hypothesis is a library that can generate arbitrary data that conforms to a given specification.
hypothesis-jsonschema makes it possible to convert JSON Schema into specifications that can be used by Hypothesis.
Here is an example showing a unit test written using Hypothesis and hypothesis-jsonschema:
from hypothesis import given
from hypothesis_jsonschema import from_schema
@given(from_schema({"type": "integer", "minimum": 1, "exclusiveMaximum": 10}))
def test_integers(value):
assert isinstance(value, int)
assert 1 <= value < 10
Answer from Alice Heaton on Stack OverflowVideos
A library that does exactly this is hypothesis-jsonschema
Hypothesis is a library that can generate arbitrary data that conforms to a given specification.
hypothesis-jsonschema makes it possible to convert JSON Schema into specifications that can be used by Hypothesis.
Here is an example showing a unit test written using Hypothesis and hypothesis-jsonschema:
from hypothesis import given
from hypothesis_jsonschema import from_schema
@given(from_schema({"type": "integer", "minimum": 1, "exclusiveMaximum": 10}))
def test_integers(value):
assert isinstance(value, int)
assert 1 <= value < 10
The most closest what I found within python is https://github.com/ueg1990/faker-schema, but it is not JSON-SCHEMA also there is nodejs implementation that is directly what you are searching for https://github.com/json-schema-faker/json-schema-faker
Hello guys, long time lurker on this sub but never posted before.
I created json-server, a CLI tool to create a dummy REST API from a provided json file with zero coding in seconds. For each provided resource 6 full functional endpoints are created (GET x2, POST, PUT, PATCH, DELETE), that you can use right away.
Inspired by the javascript package json-server that's where the name comes from.
The next step is to create the first release, which will include binary files for Windows, Linux and macOS. Any comments/suggestions are really welcomed. You can find more info at README file.
https://github.com/chanioxaris/json-server