OpenAI strict: true JSON Schema fixer
Automatically close every object with additionalProperties: false, convert optional fields to required nullable types, and preserve stripped constraints in descriptions.
- Error $ OPENAI_ADDITIONAL_PROPERTIES
OpenAI strict: true requires additionalProperties: false on every object.
Auto-fix: Set additionalProperties: false.
- Warn $.subject OPENAI_STRIP_MINLENGTH
Keyword "minLength" is unsupported in OpenAI strict mode.
Auto-fix: Removed "minLength" and recorded (minLength: 5) in description.
- Warn $.subject OPENAI_STRIP_MAXLENGTH
Keyword "maxLength" is unsupported in OpenAI strict mode.
Auto-fix: Removed "maxLength" and recorded (maxLength: 120) in description.
- Warn $.tags OPENAI_STRIP_UNIQUEITEMS
Keyword "uniqueItems" is unsupported in OpenAI strict mode.
Auto-fix: Removed "uniqueItems" and recorded (uniqueItems: true) in description.
- Error $ OPENAI_ALL_REQUIRED
OpenAI strict: true requires all properties in "required". Missing: priority, tags, notes.
Auto-fix: Added priority, tags, notes to required and converted them to nullable.
- Error $.$defs.CustomerContact OPENAI_ADDITIONAL_PROPERTIES
OpenAI strict: true requires additionalProperties: false on every object.
Auto-fix: Set additionalProperties: false.
- Warn $.$defs.CustomerContact.locale OPENAI_STRIP_MINLENGTH
Keyword "minLength" is unsupported in OpenAI strict mode.
Auto-fix: Removed "minLength" and recorded (minLength: 2) in description.
- Warn $.$defs.CustomerContact.locale OPENAI_STRIP_MAXLENGTH
Keyword "maxLength" is unsupported in OpenAI strict mode.
Auto-fix: Removed "maxLength" and recorded (maxLength: 5) in description.
- Error $.$defs.CustomerContact OPENAI_ALL_REQUIRED
OpenAI strict: true requires all properties in "required". Missing: locale.
Auto-fix: Added locale to required and converted them to nullable.
{
"type": "json_schema",
"json_schema": {
"name": "create_support_ticket",
"description": "File a customer support ticket with optional billing context.",
"strict": true,
"schema": {
"title": "CreateSupportTicket",
"description": "File a customer support ticket with optional billing context.",
"type": "object",
"$defs": {
"CustomerContact": {
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email"
},
"locale": {
"type": [
"string",
"null"
],
"description": "(minLength: 2) (maxLength: 5)"
}
},
"required": [
"email",
"locale"
],
"additionalProperties": false
}
},
"properties": {
"subject": {
"type": "string",
"description": "(minLength: 5) (maxLength: 120)"
},
"priority": {
"type": [
"string",
"null"
],
"enum": [
"low",
"normal",
"urgent",
""
]
},
"contact": {
"$ref": "#/$defs/CustomerContact"
},
"tags": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
},
"description": "(uniqueItems: true)"
},
"notes": {
"type": [
"string",
"null"
],
"default": null
}
},
"required": [
"subject",
"priority",
"contact",
"tags",
"notes"
],
"additionalProperties": false
}
}
} OpenAI Structured Outputs strict mode rules
When strict: true is enabled on response_format or function tools, OpenAI compiles the schema into a context-free grammar and rejects non-conforming JSON Schema with HTTP 400.
| Error pattern | Why OpenAI returns 400 | SchemaGate auto-fix |
|---|---|---|
Missing additionalProperties: false | Every object (root, nested, and inside $defs) must explicitly forbid extra keys. | Injects additionalProperties: false recursively across all object nodes. |
Optional keys omitted from required | Strict mode requires every key in properties to appear in required. | Adds missing keys to required and converts each optional schema to nullable. |
oneOf or multi-branch allOf | Only anyOf is supported for unions; oneOf is rejected. | Renames oneOf to anyOf and merges object allOf branches. |
minLength, maxLength, uniqueItems | Unsupported keywords fail schema validation in strict mode. | Strips unsupported keywords and appends constraint notes to description. |
Root anyOf or primitive | Top-level schema must be type: "object". | Flags as Blocked so you can wrap the value in a named root property. |