A Small Example of unevaluatedProperties

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:

  1. Validate the incoming JSON request against the Draft 2020-12 schema.
  2. Reject unknown properties with a structured client error.
  3. Only after validation, choose the CometAPI endpoint/model route from an explicit server-side policy.
  4. 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

A useful extension for an image-producing gateway is to make the validation boundary follow the production stages rather than one oversized request object. Keep generation controls such as the prompt, seed, aspect ratio, and image dimensions in one schema, and keep compositor controls such as layer order, masks, crop policy, and output format in another. A pipeline can then validate each stage before handing its result to the next one.

unevaluatedProperties: false is particularly valuable at that boundary when reusable schemas add controls through composition. An accidental field like negative_prompts or maskFeather should be rejected unless the schema for that stage explicitly evaluates it; silently carrying it forward can make a visual difference appear to come from a model or seed when the field was never consumed. The error should identify the stage and the unexpected property, not merely return a generic invalid-request message.

For evolving contracts, version the stage schema and record the normalized, accepted control set alongside the render request. Validation still does not prove that a model honors every accepted control, but it does establish which controls the downstream builder was allowed to use. That makes a later comparison of composition, materials, or output dimensions traceable without confusing an ignored parameter with a change in the image-generation route.