OAI-SE Structured Outputs & Strict JSON Schemas MEDIUM
PRODUCTION SCENARIO
A strict json_schema for user_record sets additionalProperties false at the root and lists id, email and address in required. The nested address object declares street, city and postcode but lists only street in its own required array. The API returns a 400 for an invalid schema.

Which strict-mode requirement does this schema violate?

Answering here is anonymous. Nothing is saved unless you sign in.

Show answer and explanation

Answer: Every nested object needs its own additionalProperties false and its own required array

Under strict mode the rules apply to every object in the schema, not only the root, so the nested address object needs additionalProperties false of its own and city and postcode listed alongside street in its own required array. Moving the definition into $defs changes where it is written rather than whether its properties are required, a nested required array lists that object's own fields rather than the root's, and flattening one level of nesting does not supply the missing entries.
Free

Keep practicing OAI-SE

24 original OAI-SE practice questions, each with an explanation and a source link. No account needed.

Start free practice set → Timed, explained, free