json: add integ. test case for additionalProperties

This commit is contained in:
ochafik 2024-06-22 20:55:46 +01:00
parent 2f1a087c6b
commit 5c2d3fa1ae

View file

@ -835,6 +835,29 @@ static void test_json_schema() {
}
);
test_schema(
"additional properties can't override other properties",
R"""({
"properties": {
"a": {"type": "integer"},
"b": {"type": "integer"}
},
"additionalProperties": true
})""",
// Passing strings
{
"{\"a\": 42}",
"{\"c\": \"\"}",
"{\"a\": 42, \"c\": \"\"}",
"{\"a_\": \"\"}",
},
// Failing strings
{
"",
"{\"a\": \"\"}",
"{\"a\": \"\", \"b\": \"\"}",
}
);
// Properties (from: https://json-schema.org/understanding-json-schema/reference/object#properties)
test_schema(