unevaluatedProperties is easiest to understand as an annotation trace, not as a second, global additionalProperties switch. This example is scoped to JSON Schema Draft 2020-12.
Start with two reusable pieces
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{
"properties": {
"prompt": { "type": "string" }
},
"required": ["prompt"]
},
{
"properties": {
"temperature": { "type": "number", "minimum": 0, "maximum": 2 }
}
}
],
"unevaluatedProperties": false
}
For this object, the successful properties applicators contribute the names prompt and temperature. The final applicator then checks the names left over:
input names = { prompt, temperature, debug }
evaluated names = { prompt, temperature }
unevaluated names = { debug }
Because debug is not in the evaluated set, unevaluatedProperties: false rejects the instance. An object containing only prompt and temperature passes this particular boundary, assuming the values pass their own schemas.
The important detail is “successfully evaluated.” A property name is not automatically covered merely because it appears in a branch that failed. The Draft 2020-12 Core specification describes this vocabulary in terms of successful annotation results gathered across relevant subschemas, including adjacent in-place applicators and dynamic scope. That is why moving unevaluatedProperties into a reusable schema can behave differently from placing additionalProperties inside one branch: the latter cannot see the complete annotation result from sibling composition.
Apply the boundary to a CometAPI gateway
This makes a useful request-contract boundary for a CometAPI integration. Put the schema check before routing:
- Validate the incoming JSON request against the Draft 2020-12 schema.
- Reject unknown properties with a structured client error.
- Only after validation, choose the CometAPI endpoint/model route from an explicit server-side policy.
- Record the selected route and estimate its cost using the current CometAPI pricing page; schema acceptance itself is not a model or price decision.
For example, a gateway may accept prompt and temperature while rejecting an accidental debug, admin, or misspelled temprature field before it reaches a downstream request builder. Keep that validation policy separate from routing policy: a valid payload still does not determine which model, endpoint, or price tier the gateway should use.
A practical checklist
- Declare Draft 2020-12 explicitly when this annotation behavior matters.
- Trace which applicators successfully evaluated each property name.
- Test both a valid object and an object with one unexpected name.
- Exercise failed branches and nested composition; do not assume every validator exposes the trace.
- Recheck CometAPI route availability and pricing at implementation time.
Sources: JSON Schema Draft 2020-12 Core · CometAPI pricing