[ { "description": "additionalProperties validates properties not matched by properties", "schema": { "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { "foo": { "type": "string" }, "bar": { "type": "number" } }, "additionalProperties": { "type": "boolean" } }, "tests": [ { "description": "defined properties are valid", "data": { "foo": "value", "bar": 123 }, "valid": true }, { "description": "additional property matching schema is valid", "data": { "foo": "value", "is_active": true, "hidden": false }, "valid": true }, { "description": "additional property not matching schema is invalid", "data": { "foo": "value", "is_active": 1 }, "valid": false } ] }, { "description": "extensible: true with additionalProperties still validates structure", "schema": { "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { "foo": { "type": "string" } }, "extensible": true, "additionalProperties": { "type": "integer" } }, "tests": [ { "description": "additional property matching schema is valid", "data": { "foo": "hello", "count": 5, "age": 42 }, "valid": true }, { "description": "additional property not matching schema is invalid despite extensible: true", "data": { "foo": "hello", "count": "five" }, "valid": false } ] }, { "description": "complex additionalProperties with object and array items", "schema": { "$schema": "https://json-schema.org/draft/2020-12/schema", "properties": { "type": { "type": "string" } }, "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "tests": [ { "description": "valid array of strings", "data": { "type": "my_type", "group_a": [ "field1", "field2" ], "group_b": [ "field3" ] }, "valid": true }, { "description": "invalid array of integers", "data": { "type": "my_type", "group_a": [ 1, 2 ] }, "valid": false }, { "description": "invalid non-array type", "data": { "type": "my_type", "group_a": "field1" }, "valid": false } ] } ]