JSON Schema
Structured Output JSON-Schema Validator
Paste a JSON Schema and check it against each provider's structured-output rules, with a list of unsupported constructs and fixes.
No problems found. This schema satisfies OpenAI Structured Outputs rules.
TL;DR
Paste a JSON Schema and check it against a provider's structured-output rules. OpenAI and Anthropic strict modes demand additionalProperties: false and every property in required (optional fields become nullable), and ignore value constraints; Gemini's responseSchema is more lenient on those but drops $ref and composition keywords. The supported-vs-unsupported table is below.
Supported JSON-Schema features by provider
Updated Jul 5, 2026| JSON-Schema feature | OpenAI | Gemini | Anthropic |
|---|---|---|---|
| type, properties, required | Yes | Yes | Yes |
| enum / const | Yes | Yes | Yes |
| anyOf | Yes | Yes | Yes |
| oneOf / allOf / not | No | No | No |
| $ref / $defs | Yes | responseJsonSchema only | Yes |
| additionalProperties: false | Required | Not supported | Required |
| All properties in required | Required | Optional | Required |
| String length / pattern / format | Ignored | Yes | Partial |
| Numeric minimum / maximum | Ignored | Yes | Partial |
| min/maxItems | Ignored | Yes | Partial |
| patternProperties / if-then-else | No | No | No |
How it works
The validator walks your schema and applies each provider's rule set: for OpenAI and Anthropic strict modes it flags objects missing additionalProperties: false and properties missing from required; for all providers it flags unsupported keywords (oneOf, allOf, not, patternProperties, and — for Gemini's native schema — $ref). It accepts a bare schema or an OpenAI response_format wrapper.
Provider rules for structured output evolve — this reflects the documented behavior as of 2026-07-05; verify against each provider's structured-output docs before shipping. Validation runs entirely in your browser.
FAQ
- What JSON Schema does OpenAI Structured Outputs require?
- In strict mode, every object must set "additionalProperties": false and list every property in "required" — optional fields must be typed as a union with null (e.g. ["string", "null"]) rather than omitted. String/number constraints (minLength, pattern, minimum, etc.) are ignored, and oneOf/allOf/not/patternProperties are unsupported. The root must be an object.
- Why is my structured-output schema rejected?
- The most common causes are a missing "additionalProperties": false on an object, a property not listed in "required", or an unsupported keyword like oneOf, allOf, not, or $ref (in Gemini's native responseSchema). Paste your schema above and pick your provider to see the exact issues and how to fix each one.
- How do OpenAI, Gemini, and Anthropic structured-output rules differ?
- OpenAI and Anthropic strict modes require closed objects (additionalProperties: false) with all properties required, and ignore value constraints. Gemini's responseSchema does not use additionalProperties, allows optional fields, and does honor value constraints (min/maxItems, ranges, pattern) — but it doesn't support $ref in the native schema. The comparison table below lays out each feature.
- How do I make a field optional in strict structured outputs?
- You can't simply leave it out of "required" — OpenAI and Anthropic strict modes require every property to be listed. Instead, keep it in "required" and make its type nullable, e.g. "assignee": { "type": ["string", "null"] }. The model then returns null when the field doesn't apply.