Skip to main content

JSON Schema support

This release uses JSON Schema 2020-12 and supports the following subset for generation. A valid schema must also fit within the service’s compilation limits.

Structural values​

FeatureGeneration support
Boolean, null, finite enum and constSupported
Declared object properties and required keysSupported within compiler limits
Bounded arraysSupported within compiler limits
Open strings and numbersSupported with execution token budgets
Numeric bounds over finite choicesSupported
One-sided integer boundsSupported: minimum, maximum and exclusive bounds
Arbitrary bounds on open fractional numbersNot included in the verified generation forms below
Bounded integer rangesSupported when the finite range fits compiler limits
Conditional and composed finite fieldsSee the keyword coverage below
Local nonrecursive $defs / $refSupported JSON Pointer references
Recursive, dynamic or external referencesNot supported
Dynamic property synthesisNot supported

type: number does not make an arbitrary minimum, maximum or multipleOf constraint supported for open generation. Use finite allowed values when they match the task.

Conditions and composition​

These constraints apply to the generated output, not directly to request input or application state.

For fields narrowed by a branch, declare initial choices with explicit enum or const values. The linked guides provide complete schemas for this supported form.

ConstructGeneration coverage
if, then, elseFinite field conditions, including nested branches and conditional presence.
dependentRequiredPresence of a declared property requires companion properties; the trigger is presence, not truthiness.
dependentSchemasNot included in this release’s supported generation subset.
allOfIntersect compatible finite constraints, including multiple conditional rules; also supported string intersections.
anyOfFinite alternatives; one or more branches may match.
oneOfFinite alternatives; exactly one branch must match.
notExclude values or combinations within a declared finite domain.

Read Conditional outputs for complete examples of conditional fields and dependencies. Combine constraints covers alternatives and exclusions; Reuse schema definitions covers local references. Valid schemas can still exceed compilation limits; cross-field rules coupled to open-ended values are not supported in this release.

Strings​

ConstraintBehavior
minLength, maxLengthDecoded Unicode character count; character bounds up to 4,096
patternRegular subset: literals, classes, ranges, negation, groups, alternation, repetition, outer anchors and search semantics
Character escapesASCII \d and \w, ECMA whitespace, supported Unicode properties
allOfIntersection of supported string assertions

Backreferences, lookarounds, interior anchors, named groups and inline flags are unsupported. Arbitrary anyOf, oneOf and not combinations over open strings are also unsupported. Combining otherwise supported constraints may exceed compilation limits.

Formats during generation​

date, time, date-time, duration, uuid, ipv4, json-pointer and relative-json-pointer are supported. Format assertions are enabled by default.

Dates obey Gregorian calendar rules. RFC 3339 time and date-time include a timezone, optional fractional seconds and valid offset/leap-second relationships. IPv4 enforces octet ranges without leading-zero octets. JSON pointers enforce valid escapes.

Generated email, hostname, IPv6, URI/IRI and regex-format strings are not supported in this release. A validator accepting supplied values of those formats does not establish generation support.

Execution extensions​

Only these x-runtime annotations are approved in this release:

AnnotationSupported use
formatAssertionsRoot Boolean; enables format assertions by default.
requestSchemaRoot JSON Schema that validates the supplied input, parameters, state and user context before generation.
stateSchemaRoot JSON Schema that validates the resulting state snapshot. It does not validate the initial request.
eligibleWhenA request-context predicate controlling whether a field is allowed. Required fields must retain a legal value.
choicesPer-value eligibleWhen conditions on finite choices.
propertyOrderOn an object schema: an array listing every declared property exactly once, in generation order.
switchOrdered cases over an output value, with a required default. See switches.
forEach, bindRepeat a template result for each supplied item and bind its constants or descriptions. See for-each loops.
label_permutationsOne finite string field, with {"scope":"/input/responses"} selecting an object whose keys match the enum.
probabilitiesBoolean on the field: true returns probabilities; false or omission disables them. Works with or without label_permutations. Legacy "all"/"none" remain accepted.

The candidate probabilities guide shows a finite string choice without label permutations. Probability collection preserves ordinary token-by-token selection; it does not replace the answer with the candidate having the highest complete-label probability. See Reduce label bias for the separate permutation setting and its scope rules.

For the finite-choice eligibility shown in the guides, put x-runtime inside the controlled field's schema, alongside type or enum. choices.<value>.eligibleWhen controls whether that value is available. Required fields must retain a legal value.

Eligibility predicates can refer to input, parameters, state and user_context. They cannot depend on the generated output. For example, {"contains":[{"ref":"user_context/scopes"},"documents:publish"]} checks exact scope membership. Missing scopes do not grant that permission. Conditions using state shows each form separately, then combines eligibility with ordinary output conditions. Use state rules in OPA for richer relationships involving generated values.

Attach OPA through request-level policy or policy_id, independently of the output schema, for ordinary generation.

propertyOrder is a Struct extension, not a JSON Schema keyword. For an object declaring category and reason, use "x-runtime":{"propertyOrder":["category","reason"]} to generate the category first. Omitted, repeated or unknown property names are rejected. Without the annotation, properties use lexicographic order. Required and optional properties must both appear in the list; ordering does not make an optional property required. JSON consumers should still access values by key.

Exact source quotations​

Use x-runtime.quote on a string with maxLength from 1 to 4,096 to return an exact contiguous excerpt from request input. Its ref is a JSON Pointer to a string under /input. The number, date, word, identifier, passage and span units are semantic hints; every quoted value is still a string. Unicode spelling, whitespace and punctuation are preserved.

Allow null explicitly when absence is valid. Put the annotation on array items to extract multiple strings, with maxItems no greater than 256. Source membership and the surrounding schema constraints both apply; neither guarantees that the selected information answers the question correctly. Quote requests cannot be combined with OPA policies. The source quoting guide includes a complete extraction example.

Unsupported schemas​

Compilation fails for unsupported constructs or excessive complexity. The service does not silently remove constraints and retry unconstrained. Keep the original error and simplify the schema or select a supported representation.

Strict format checking can be disabled with root "x-runtime":{"formatAssertions":false}. Only use that when formats are intended as annotations rather than guarantees.