Skip to content

JSON Schema Examples

Ravi Kiran Pagidi edited this page Jun 28, 2026 · 1 revision

JSON Schema Examples

Status

Planned. generate_from_schema does not currently parse JSON Schema objects or files.

What it is and when to use it

JSON Schema describes API payloads and data contracts using properties, types, formats, required fields, ranges, and enumerations. It is valuable for API, event, and contract-testing teams.

Planned API shape

# Planned, not runnable today
schema = {
    "type": "object",
    "properties": {
        "customer_id": {"type": "string"},
        "customer_name": {"type": "string"},
        "age": {"type": "integer", "minimum": 18, "maximum": 85},
        "email": {"type": "string", "format": "email"},
        "status": {"type": "string", "enum": ["Active", "Inactive"]},
    },
}

# Future shape
df = generate_from_schema(schema, rows=1000)

Planned output preview

{"customer_id":"CUST000001","customer_name":"Ava Johnson","age":34,"email":"ava.johnson@example.com","status":"Active"}

Supported alternative today

from great_generator import generate_from_schema

types = {
    "customer_id": "string",
    "customer_name": "string",
    "age": "int",
    "email": "string",
    "status": "string",
}
rules = {
    "age": {"min": 18, "max": 85},
    "status": {"values": ["Active", "Inactive"]},
}

df = generate_from_schema(types, rows=1000, custom_rules=rules)
df.to_json("customers.json", orient="records", lines=True)

Notes and limitations

JSON dataset recipe files are supported by generate_from_recipe; that does not mean JSON Schema is supported. Nested objects, arrays, $ref, composition, and format validation remain roadmap work.

Clone this wiki locally