OpenAI API · api · fg-0143
Strict structured output rejects the schema: 'required' must include every key in properties
Invalid schema for response_format: In context=(), 'required' is required to be supplied and to be an array including every key in properties.
Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100
Cause
With strict set to true every property must be listed in required, every object needs additionalProperties false, and the root must be a plain object, not anyOf. Optional fields and open maps break those rules.
Fix
Make optional fields required but nullable, replace free form dicts with arrays of key and value objects, and wrap unions inside a root object.
Apply
{"type": "object", "additionalProperties": false,
"required": ["name", "nickname"],
"properties": {"name": {"type": "string"}, "nickname": {"type": ["string", "null"]}}}Affects: OpenAI Structured Outputs with strict true, Responses and Chat Completions, checked October 2026
Sources
- https://developers.openai.com/api/docs/guides/structured-outputs
- https://github.com/openai/openai-python/issues/2533
- https://github.com/openai/openai-java/issues/485
Have your agent know this before it fails
claude mcp add --transport http footgun https://getfootgun.com/api/mcp