Output schema max_depth: 10 levels, and $defs recursion is free
Sume's output_schema allows 10 levels of literal nesting. Past that you get max_depth. A self-referencing $defs entry does not add to the depth count.

A Format output_schema that nests objects more than 10 levels deep is rejected with 400 output_schema_invalid and the rule max_depth. Flatten the shape, or move the inner objects into root $defs and reference them. The depth limit counts literal nesting in the document, and a self-referential $defs entry does not increase it (Structured output).
What counts as a level
Each properties or items step inside the document is a level. A $ref is not followed when Sume counts. That is why a tree such as a comment thread can be written with one definition that refers to itself.
{
"type": "object",
"additionalProperties": false,
"required": ["outline"],
"properties": { "outline": { "$ref": "#/$defs/node" } },
"$defs": {
"node": {
"type": "object",
"additionalProperties": false,
"required": ["title", "children"],
"properties": {
"title": { "type": "string" },
"children": { "type": "array", "items": { "$ref": "#/$defs/node" } }
}
}
}
}Rules that still apply
If a human can not read your schema at 10 levels, the model will fill it worse. Prefer a flat list of items with a parent_id string over a deep tree when the consumer is a spreadsheet or a database.
$defsmust sit at the root of the schema. A nested$defsblock givesunsupported_ref.$ref: "#"is rejected. Recurse through a named definition instead.- Every definition object also needs
additionalProperties: falseand a fullrequiredlist.
Sources
Related posts
More in Formats
- Output schema max_string_length: descriptions use a 120,000 budget
A big Format output_schema can fail with max_string_length although no field is long. The 120,000-character budget covers every key, name and string in it.
- Output schema node with only a description: missing_type violation
A property with only a description is legal JSON Schema, but Sume rejects it with missing_type. Give it a type, a $ref or an anyOf, and move constraints.
- Output schema required_completeness: list every property in required
Sume's strict output_schema wants every declared property in required, and no required entry without a property. Make a field optional with a null union.
- Output schema type float or date rejected: unsupported_type
Sume's output_schema accepts seven types only. A float, date or any type gets the rule unsupported_type. Map each to number, string with format, or an enum.
Written by Sume