Loading...
{
"type": "object",
"properties": {
"city": { "type": "string" },
"unit": { "type": "string" }
}
}{
"type": "object",
"properties": {
"city": { "type": "string", "description": "City name, e.g. 'Paris'" },
"unit": { "type": "string", "enum": ["celsius", "fahrenheit"] }
},
"required": ["city", "unit"],
"additionalProperties": false
}Descriptions, enum, 'required' and 'additionalProperties' make the model fill the right fields with allowed values.
No. Strict structured output modes often support only a subset, for example requiring 'additionalProperties': false and every field in 'required'.
Yes, schema libraries like Zod can produce JSON Schema and also validate the model's response at runtime, keeping one source of truth.
When every field must be listed in 'required', make it nullable with a type like ['string', 'null'] and treat null as missing.