← Back to Home

JSON Schemas

Schema definitions for DGP queries, responses, and domain components

v0.9.0

{ } Query Schema

Defines the structure for querying entities, including filters, relationship traversal, aggregations, and pagination options.

query.schema.json 6.7 KB

{ } Response Schema

Defines the response format including data payload, execution metadata, cost breakdown, freshness indicators, and provenance information.

response.schema.json 12 KB

{ } Components Schema

Reusable schema components for entities, types, relationships, state machines, computed fields, constraints, and operations.

components.schema.json 29 KB

Usage

These JSON schemas can be used to validate DGP requests and responses in your implementation:

# Validate a query using jsonschema (Python)
import jsonschema
import json

with open('query.schema.json') as f:
    schema = json.load(f)

query = {
    "query": {
        "entity": "Customer",
        "where": {"segment": {"eq": "enterprise"}},
        "include": {"orders": {"limit": 10}},
        "options": {"consistency": "bounded_staleness", "max_staleness_ms": 30000}
    }
}

jsonschema.validate(query, schema)  # Raises if invalid

Or reference them directly in your JSON documents:

{
    "$schema": "https://dgp.dev/schema/query.schema.json",
    "query": {
        "entity": "Customer",
        "where": {"id": {"eq": "cust_123"}}
    }
}