What this thread does
Treat allOf as an intersection of constraints, and place unevaluatedProperties: false on the composed object after leaving its reusable branches open.
As of November 2026; checked 2026-11-08. The example uses 2020-12; unevaluatedProperties first appeared in 2019-09, and 2020-12's release notes retain that model.
What changed
allOfdoes not merge property maps or let the last branch override the first. The same instance must satisfy every branch. Composition referenceadditionalProperties: falsesees siblingpropertiesandpatternPropertiesin its own schema object. A property introduced elsewhere can remain forbidden. Object reference
Do first: move closure to the composition boundary
Suppose a base permits only reference, while another branch requires status. With additionalProperties: false inside the base, an object containing status fails the base branch. Another branch cannot relax that rejection.
For a validator implementing 2020-12, use this shape:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"$defs": {
"base": {
"type": "object",
"properties": { "reference": { "type": "string" } },
"required": ["reference"]
}
},
"allOf": [
{ "$ref": "#/$defs/base" },
{
"properties": { "status": { "enum": ["queued", "sent"] } },
"required": ["status"]
}
],
"unevaluatedProperties": false
}
Under these constraints, {"reference":"r1","status":"queued"} is permitted; adding "debug":true is rejected. Remove closure from the reusable base; adding an outer keyword cannot undo an inner prohibition. Official explanation, jdesrosiers' April 12, 2023 answer
For draft-07, which lacks unevaluatedProperties, keep branches open and redeclare permitted names beside the outer additionalProperties: false:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"allOf": [
{ "properties": { "reference": { "type": "string" } },
"required": ["reference"] },
{ "properties": { "status": { "enum": ["queued", "sent"] } },
"required": ["status"] }
],
"properties": { "reference": {}, "status": {} },
"additionalProperties": false
}
The empty schemas enumerate names while branches retain value constraints, following the documented workaround.
Diagnostic: a property is declared but still rejected
Inspect the schema object containing the rejecting additionalProperties, not just the combined property list. Repeated properties also retain every constraint: string in one branch and integer in another remains contradictory. A last-write-wins object merge changes that meaning. allOf semantics
Evidence and limits
Issue #556, opened March 4, 2018 by handrews, records the schema-reuse problem behind unevaluatedProperties, including duplication in OpenAPI's schema. The 2023 discussion reports failure with recursive composition and recommends an open base plus outer closure.
A $schema declaration does not add dialect support to a validator. Confirm support for the unevaluated vocabulary; API-specific schema subsets may lack it. An already-closed third-party schema cannot become extensible without changing or replacing it.
Not for: choosing Zod 4 versus Valibot or ArkType; see the validator comparison.
Started from a post by @jdesrosiers, packaged by the editor. Original post