HomeRoadmapsSynthetic Day 1
Synthetic Test Data Track Β· Day 1 Β· 20 min

OpenAPI & JSON Schema Contract Synthesis
Synthetic Test Data Sprint β€” Day 1

Synthesize realistic, contract-compliant REST payloads directly from JSON Schema and OpenAPI specifications with strict boundary and format enforcement.

⚑ Engine: Pure Python Stdlib (Deterministic)πŸ›‘οΈ Synthetic Data & Privacy Quality Architect
OpenAPIJSON SchemaSynthetic PayloadsType ConstraintsUUID/Email Formats
About this lab

You are the Synthetic Data & Privacy Quality Architect. Microservice teams frequently suffer test environment flakiness because hardcoded mock JSON files drift away from actual OpenAPI schemas. In this lab, you build a deterministic schema-driven synthesizer that generates valid REST request payloads on the fly.

πŸ“¦Sample Codebase & Working Solution (Day 1)Available Now
View on GitHub

The official reference codebase for Day 1 is hosted in the repository. Clone the repository and navigate to day-1-openapi-synthesis to run the working solution.

Git Clone β€” Working Solution
git clone https://github.com/777abhi/synthetic-test-data-roadmap.git
cd synthetic-test-data-roadmap/day-1-openapi-synthesis
🏭Production Context & Enterprise Implementation
πŸ’‘ Why We Are Doing This: Hardcoded test fixtures silently become invalid when upstream APIs update schemas. Generating synthetic data directly from the OpenAPI schema ensures tests always adhere to production contracts.
🏒 Real-World Production Usecase: Dynamically creating valid customer registration and payment payloads for microservice integration tests with UUIDs, ISO-8601 timestamps, and bounded integers.
βš™οΈ How Implemented in Production: A deterministic recursive generator in synthlab/schema_engine.py with seedable PRNG and strict JSON Schema validation.
Phase 1

Inspect the Schema Synthesizer

Clone the reference repository and inspect how schemas define properties, types, and constraints.

Step 1.1: Clone and Inspect the Lab
Terminal β€” Setup Day 1 Lab
git clone https://github.com/777abhi/synthetic-test-data-roadmap.git
cd synthetic-test-data-roadmap
cat synthlab/schema_engine.py | head -45
Step 1.2: Contract Synthesis Test Suite
test_day1.py
import unittest
from synthlab.schema_engine import SchemaSynthesizer, SchemaValidator, ValidationError

class TestDay1SchemaSynthesis(unittest.TestCase):
    def setUp(self):
        self.synth = SchemaSynthesizer(seed=1337)
        self.user_schema = {
            "type": "object",
            "required": ["id", "email", "age", "status", "tags"],
            "properties": {
                "id": {"type": "string", "format": "uuid"},
                "email": {"type": "string", "format": "email"},
                "created_at": {"type": "string", "format": "date-time"},
                "client_ip": {"type": "string", "format": "ipv4"},
                "age": {"type": "integer", "minimum": 18, "maximum": 99},
                "status": {"type": "string", "enum": ["ACTIVE", "PENDING", "SUSPENDED"]},
                "tags": {"type": "array", "minItems": 2, "maxItems": 5, "uniqueItems": True},
            },
            "additionalProperties": False,
        }

    def test_synthesized_payload_passes_validation(self):
        payload = self.synth.synthesize(self.user_schema)
        SchemaValidator.validate(payload, self.user_schema)
        self.assertIn("@", payload["email"])
        self.assertGreaterEqual(payload["age"], 18)
        self.assertLessEqual(payload["age"], 99)
Phase 2

Execute Day 1 Tests

Run the schema synthesis test suite and verify contract conformance.

Step 1.3: Run Test Suite
Terminal β€” Run Day 1 Tests
npm run test:day1
Day 1 Key Learnings
  • Built a recursive schema generator that honors string formats (UUID, email, date-time, IPv4).
  • Enforced numeric bounds (minimum, maximum, multipleOf) and array uniqueItems constraints.
  • Guaranteed deterministic reproducibility across test runs using seedable pseudorandom generators.

🧠 Knowledge Check

Why is deterministic seedable synthesis critical for integration test fixtures?