JSON-Schema-Test-Suite icon indicating copy to clipboard operation
JSON-Schema-Test-Suite copied to clipboard

test a malformed pattern

Open karenetheridge opened this issue 5 years ago • 5 comments
trafficstars

I noticed we had no tests for bad patterns.

karenetheridge avatar Jun 03 '20 16:06 karenetheridge

An invalid schema doesn't return either valid or invalid; the validity of the instance is indeterminate.

awwright avatar Jun 03 '20 22:06 awwright

Putting on hold until we can figure out how to test schemas that would cause an implementation to throw an exception / send up an error / do something other than return validated=true/false.

karenetheridge avatar Nov 16 '20 23:11 karenetheridge

It's going to be more backwards compatible for users of the suite to put these kinds of tests in a separate folder (because one wouldn't know to reference the flag until after we add such a thing).

So there's seemingly little disadvantage to doing it in a separate folder which we can bikeshed on (neither-valid-nor-invalid-tests/); I think I once discussed some of this with @ssilverman and put some notes in a doc.

But yes we should decide how to handle that "once" and then do it here, agreed.

Julian avatar Nov 17 '20 00:11 Julian

I don't anticipate many compatibility problems, depending on how the tests are written. Especially if the "tests" property is empty or missing, that should not pose a compatibility problem.

However, I think the most intuitive way to write this would be to use tests: null to indicate the schema itself is malformed:

[
    {
        "description": "enum range error",
        "schema": { "enum": 4 },
        "tests": null
    }
]

awwright avatar Nov 18 '20 03:11 awwright