Schema definitions for DGP queries, responses, and domain components
v0.9.0Defines the structure for querying entities, including filters, relationship traversal, aggregations, and pagination options.
Defines the response format including data payload, execution metadata, cost breakdown, freshness indicators, and provenance information.
Reusable schema components for entities, types, relationships, state machines, computed fields, constraints, and operations.
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"}}
}
}