Skip to main content

anyof-objects

Category: Semantic — schema semantics trigger this rule

Error Codes​

ProfileCodeSeverity
openai.so.2026-04-30OAI-S-anyof-objectsWarn
anthropic.so.2026-04-30ANT-S-anyof-objectsWarn

Description​

anyOf with only object-typed branches may not be fully supported

Provider Evidence​

ProfileStatusSourceBasis
anthropic.so.2026-04-30inferredAnthropic JSON Schema limitationsEach anyOf branch must remain within Anthropic's supported subset.
openai.so.2026-04-30documentedOpenAI anyOf requirements—

Rationale​

When all anyOf branches are object-typed, some providers may not correctly resolve the union. Merging branches into a single object schema when appropriate improves compatibility across providers.

Bad Example​

{
"type": "object",
"anyOf": [
{ "type": "object", "properties": { "x": { "type": "string" } } },
{ "type": "object", "properties": { "y": { "type": "number" } } }
]
}

Good Example​

{
"type": "object",
"properties": {
"x": { "type": "string" },
"y": { "type": "number" }
}
}