encoding/jsonschema: add test cases for excluded types
The jsonschema logic currently produces "constraint not allowed
because type is excluded" errors. Although such errors
do often represent a mistake on the part of the author
of the schema, they are not technically errors.
A classic example might be the following:
{
"enum": ["a", "b"],
"type": ["string", "null"]
}
Even though we know that the only values possible
are `"a"` and `"b"` so the `null` type constraints is redundant,
it's OK to include it, and it's common to see this
kind of thing in schemas in the wild.
The test cases were all taken from real-life schemas.
For #393.
Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I59f46f5f2002ed21e822731d0bce294399f2d892
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199397
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>