Skip to content

Commit

Permalink
json: add test for type: [array, null] fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ochafik committed Jun 22, 2024
1 parent 9c2cc11 commit 9676f22
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test-grammar-integration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,29 @@ static void test_json_schema() {
}
);

test_schema(
"",
// Schema
R"""(
{
"type": ["array", "null"],
"items": { "type": "string" }
}
)""",
// Passing strings
{
"null",
"[]",
"[\"foo\"]",
"[\"foo\", \"bar\"]",
},
// Failing strings
{
"",
"\"foo\"",
"[\"foo\", 42]",
}
);

test_schema(
"min+max items",
Expand Down

0 comments on commit 9676f22

Please sign in to comment.