TeDS (Test-Driven Schema Development Tool) - CLI for verifying JSON Schema contracts using YAML test specifications
Project description
TeDS — Test‑Driven Schema Development Tool
TeDS (Test‑Driven Schema Development Tool) is a CLI to specify and test your JSON Schema contracts using YAML test specifications. Verify that your schemas accept what they should and reject what they must.
Why TeDS?
APIs live and die by their contracts. Most teams only test the "happy path" — but what about ensuring your schema actually rejects invalid data? TeDS fills this gap by testing both sides of your schema contract:
- Positive cases: Schema accepts valid data (including examples)
- Negative cases: Schema rejects invalid data (explicit invalid cases)
- Contract clarity: Tests serve as living documentation
- CI integration: Deterministic validation prevents regressions
Quick Start
Installation
# From PyPI (recommended)
pip install teds
# From source (development)
git clone https://github.com/yaccob/teds.git
cd teds
python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
Basic Usage
# Verify a test specification
teds verify demo/sample_tests.yaml
# Generate tests from schema examples
teds generate demo/sample_schemas.yaml#/components/schemas
# Generate reports
teds verify demo/sample_tests.yaml --report default.html
Core Concepts
Test Specifications
TeDS uses YAML files to define what should be valid or invalid for your schemas:
version: "1.0.0"
tests:
schema.yaml#/User:
valid:
simple_user:
description: Basic valid user
payload:
id: "12345"
name: "Alice"
email: "alice@example.com"
invalid:
missing_email:
description: User without required email
payload:
id: "12345"
name: "Alice"
Schema References
Point to specific schemas using JSON Pointer syntax:
schema.yaml#/User- Root level User schemaapi.yaml#/components/schemas/User- OpenAPI style referencedefinitions.yaml#/$defs/Address- JSON Schema 2020-12 style
Commands
Verify Test Specifications
# Basic verification
teds verify my_tests.yaml
# Filter output levels
teds verify my_tests.yaml --output-level error # Only errors
teds verify my_tests.yaml --output-level warning # Warnings and errors
teds verify my_tests.yaml --output-level all # Everything
# Update test files in place
teds verify my_tests.yaml --in-place
# Generate reports
teds verify my_tests.yaml --report default.html
teds verify my_tests.yaml --report default.md
teds verify my_tests.yaml --report default.adoc
Generate Test Specifications
# Generate from schema root
teds generate schema.yaml
# Generate from specific path
teds generate api.yaml#/components/schemas
# Multiple targets
teds generate schema1.yaml schema2.yaml#/definitions
Reports
TeDS generates professional validation reports in multiple formats:
- default.adoc - AsciiDoc with color-coded status and complete YAML payloads
- default.html - HTML with responsive design and syntax highlighting
- default.md - Markdown with emoji status indicators
- summary.md - Compact summary with counts and references
- summary.html - Simple HTML summary
Reports show complete test results with clean YAML formatting and clear message separation.
Exit Codes
- 0 - Success (all tests passed)
- 1 - Validation failures (some tests had ERROR results)
- 2 - Hard failures (I/O errors, invalid testspec, schema resolution issues)
Tutorial
For a comprehensive step-by-step guide, see the complete tutorial.
Development
# Setup
python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
# Run tests
pytest -q
# Build
pip install hatch && hatch build
Security & Network Access
By default, TeDS only resolves local file references for security and reproducibility. Enable network access for remote $ref resolution:
teds verify spec.yaml --allow-network
teds generate schema.yaml --allow-network
Network access includes timeouts and size limits. Override via environment:
TEDS_NETWORK_TIMEOUT(seconds, default: 5)TEDS_NETWORK_MAX_BYTES(bytes, default: 5MB)
Contributing
- Use Conventional Commits (feat, fix, docs, etc.)
- Keep changes focused and add tests under
tests/ - Run tests before submitting:
pytest -q
License
[Add license information]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file teds-0.4.1.post4.tar.gz.
File metadata
- Download URL: teds-0.4.1.post4.tar.gz
- Upload date:
- Size: 97.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4cf9eafe6952e90b820250f318760c2fbdb4d1aa662a6d35634e283a9c7ebf5
|
|
| MD5 |
a3b7c13ba17f7825bb821d8419bf62d0
|
|
| BLAKE2b-256 |
b14e512903fb2079595de7635f98d3b31304442a9114f988de944f3597d02c8a
|
Provenance
The following attestation bundles were made for teds-0.4.1.post4.tar.gz:
Publisher:
release.yml on yaccob/teds
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
teds-0.4.1.post4.tar.gz -
Subject digest:
e4cf9eafe6952e90b820250f318760c2fbdb4d1aa662a6d35634e283a9c7ebf5 - Sigstore transparency entry: 546532473
- Sigstore integration time:
-
Permalink:
yaccob/teds@d25ea1e091e8244820c1ce29ff5a790a92307c91 -
Branch / Tag:
refs/tags/v0.4.1.post4 - Owner: https://github.com/yaccob
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d25ea1e091e8244820c1ce29ff5a790a92307c91 -
Trigger Event:
push
-
Statement type:
File details
Details for the file teds-0.4.1.post4-py3-none-any.whl.
File metadata
- Download URL: teds-0.4.1.post4-py3-none-any.whl
- Upload date:
- Size: 36.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2e5abcad78a87cbcb377223afc2f78e38ced662eb72ced03ec0e20de66c67a6
|
|
| MD5 |
ad1d16f45c15eb72fca63e1e443a2fca
|
|
| BLAKE2b-256 |
dec5c33108a4bded561630d999847700e2d2e2617ba2ba8139b573192b1bd051
|
Provenance
The following attestation bundles were made for teds-0.4.1.post4-py3-none-any.whl:
Publisher:
release.yml on yaccob/teds
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
teds-0.4.1.post4-py3-none-any.whl -
Subject digest:
f2e5abcad78a87cbcb377223afc2f78e38ced662eb72ced03ec0e20de66c67a6 - Sigstore transparency entry: 546532479
- Sigstore integration time:
-
Permalink:
yaccob/teds@d25ea1e091e8244820c1ce29ff5a790a92307c91 -
Branch / Tag:
refs/tags/v0.4.1.post4 - Owner: https://github.com/yaccob
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d25ea1e091e8244820c1ce29ff5a790a92307c91 -
Trigger Event:
push
-
Statement type: