Skip to main content

recursive-schema

Category: Structural — overall schema structure triggers this rule

Error Codes​

ProfileCodeSeverity
anthropic.so.2026-04-30ANT-S-recursive-schemaForbid

Description​

A schema must not contain a $ref cycle

Provider Evidence​

ProfileStatusSourceBasis
anthropic.so.2026-04-30documentedAnthropic JSON Schema limitations—

Rationale​

Anthropic's structured-outputs documentation lists "Recursive schemas" among the unsupported schema features.

Bad Example​

{ "type": "object", "properties": { "root": { "$ref": "#/$defs/Node" } }, "$defs": { "Node": { "type": "object", "properties": { "next": { "$ref": "#/$defs/Node" } } } } }

Good Example​

{ "type": "object", "properties": { "root": { "$ref": "#/$defs/Node" } }, "$defs": { "Node": { "type": "object", "properties": { "value": { "type": "string" } } } } }