json: add test for type: [array, null] fix

This commit is contained in:
ochafik 2024-06-22 20:26:25 +01:00
parent 9c2cc11fd7
commit 9352712c80

View file

@ -773,6 +773,30 @@ static void test_json_schema() {
}
);
test_schema(
"",
// Schema
R"""(
{
"type": ["array", "null"],
"items": { "type": "string" }
}
)""",
// Passing strings
{
"null",
"[]",
"[\"123\"]",
"[\"foo\", \"bar\"]",
},
// Failing strings
{
"",
"[123]",
"\"foo\"",
"[\"foo\", 42]",
}
);
test_schema(
"min+max items",