Suppose we have schema following schema (from tutorial here):
{
\"$schema\": \"http://json-schema.org/draft-04/schema#\",
\"definitions\": {
\"addr
additionalProperties
applies to all properties that are not accounted-for by properties
or patternProperties
in the immediate schema.
This means that when you have:
{
"allOf": [
{ "$ref": "#/definitions/address" },
{ "properties":
{ "type": { "enum": [ "residential", "business" ] } },
"required": ["type"]
}
],
"additionalProperties":false
}
additionalProperties
here applies to all properties, because there is no sibling-level properties
entry - the one inside allOf
does not count.
One thing you could do is to move the properties
definition one level up, and provide stub entries for properties you are importing:
{
"allOf": [{"$ref": "#/definitions/address"}],
"properties": {
"type": {"enum": ["residential", "business"]},
"addressProp1": {},
"addressProp2": {},
...
},
"required": ["type"],
"additionalProperties":false
}
This means that additionalProperties
will not apply to the properties you want.