Function: reportDefinitionJsonSchema()
function reportDefinitionJsonSchema(): JSONSchema;Defined in: server/insights/ask/definition-schema.ts:37
The JSON Schema an Ask adapter shows the model, DERIVED from
reportDefinitionSchema rather than hand-authored.
Spike result (Zod 4.3.6): z.toJSONSchema renders the recursive z.lazy
FilterNode correctly — it hoists the node into $defs under an anonymous
key (__schema0) and points filter, children[], and not.child at it
with $ref. Nothing throws and nothing is silently flattened, so
hand-authoring (and the drift risk that comes with it) is unnecessary.
io: "input" is deliberate: this is the shape a PRODUCER must emit, so
sort (which has a .default([])) stays optional and the root required
list is exactly schemaVersion / subject / columns / timezone.
Two things JSON Schema cannot express, both covered by ASK_DEFINITION_SCHEMA_NOTES in prose and — load-bearingly — by the server re-validating every draft with the real Zod schema:
- the filter-tree depth/leaf caps, which live in a
superRefine; - the IANA-timezone
refineontimezone.
Because the filter tree is recursive, this schema must NOT be used with a provider's strict structured-output mode (recursive schemas are unsupported there); adapters pass it as documentation inside the system prompt.
Returns
JSONSchema