Closed as not planned
Description
Hi. I'm working on a schema validator for C using json-c. It's called jsonc-daccord.
Currently I'm running my test runner on the Test Suite tests/draft2020-12/patternProperties.json,
I noticed that it does not cover invalid regex patterns, and it does not cover "ignore non-object schemas"
The draft https://json-schema.org/draft/2020-12/json-schema-core.html#name-patternproperties says
The value of "patternProperties" MUST be an object.
What if it isn't ? Shall the patternProperties keyword be ignored ?Each property name of this object SHOULD be a valid regular expression, according to the ECMA-262 regular expression dialect
When it says SHOULD, it means it is recommended.. Here is my problem, I need to test my code for handling of a failed regex since C code can risk of running into segfaults and memory leaks, but since the draft indicates it is recommended, how should the outcome of the test be? If we put a test in the patternProperties.json file, the result cannot be both true and false (or ignore). I wonder if somehow the tests "valid" field should have allowed for "ignore" as well as "true" and "false". A "valid": "ignore" would increase the coverage of the tests. Or perhaps better, to make it backwards compatible, a new field could be added to the json next to "valid", it could says "ignore": true.
for clarity, here is what I suggest:
[
{
"description":
"patternProperties with invalid regex",
"schema": {
"patternProperties": {
"invalid regex, I cannot thing of one right now :)": {"type": "integer"}
}
},
"tests": [
{
"description": "a single valid match is valid",
"data": {"foo": 1},
"valid": true,
"ignore-result": true
},
]
}
]
What do you think ? :)