--- id: hypothesis-jsonschema version: "0.23.1" license: MPL 2.0 license_treatment: copyleft maintenance: aging --- # hypothesis-jsonschema — Generate test data from JSON schemata with Hypothesis License: copyleft · Maintenance: aging · Downloads: 3.4M/mo ## What it is and what it does hypothesis-jsonschema bridges Hypothesis (a property-based testing framework) and JSON Schema by converting a schema into a Hypothesis strategy that generates valid JSON data matching that schema. Rather than hand-writing test inputs, you define a schema and the package generates diverse, valid examples automatically—useful for testing APIs, data pipelines, or any code that consumes JSON. The package exposes a single public function, `from_schema()`, which takes a JSON schema and optional configuration (custom format handlers, encoding constraints) and returns a strategy for Hypothesis's `@given` decorator. It supports JSON Schema drafts 04, 05, and 07, handles non-recursive schema references, and allows you to customize how custom formats are generated. Dependencies are minimal: only hypothesis and jsonschema. Use it for: - Test REST API endpoints by generating valid JSON payloads that match your OpenAPI or JSON Schema specification. - Fuzz data validation logic by creating diverse inputs that conform to a schema but exercise edge cases. - Verify data transformation pipelines by generating schema-compliant input and checking output correctness. - Build schema-driven test suites where test data is derived automatically from your schema rather than hardcoded. - Validate custom format handlers by generating data with specific string formats (e.g., email, UUID, card numbers). ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Generates random JSON data that conforms to a given JSON schema, for use as test input in property-based testing with Hypothesis. Yes, if you use Hypothesis for property-based testing and need to generate JSON data. The package is stable, has no known vulnerabilities, and low install friction. The aging maintenance status (no release in 898 days) is a minor concern for new features but not a blocker for current use—the API is small and the underlying dependencies are mature. Suitable for production test suites. ## Install pip install hypothesis-jsonschema uv add hypothesis-jsonschema poetry add hypothesis-jsonschema ## Installing hypothesis-jsonschema Before you install: Low friction: pure Python wheel with only two runtime dependencies (hypothesis and jsonschema). Maintenance status is aging—last release was 898 days ago, though the repository remains active with a recent commit on 2025-12-05. License in practice: Licensed under MPL 2.0 (copyleft). You must disclose source modifications and can use it in proprietary code, but derivative works of the library itself must remain open-source under the same license. Quickstart: 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 Requires Python 3.8 or later. Hypothesis must be installed and configured for your test runner. Verify before relying: - Whether the package still actively maintains support for JSON Schema drafts beyond 07, or if newer drafts require manual updates. - Current compatibility with the latest versions of hypothesis and jsonschema, given the 898-day gap since last release. ## Package facts - License: MPL 2.0 (copyleft) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 3.4M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags json schema test data generation, hypothesis json schema strategy, property-based testing json, generate json from schema, json schema fuzzing, hypothesis test data, schema-driven test generation, property-based-testing, json-schema, test-data-generation [View on SkillFed](https://skillfed.io/packages/hypothesis-jsonschema) · [View on PyPI](https://pypi.org/project/hypothesis-jsonschema/)