From e7175ba78de7a7dabf7059edb0774493ea61ff06 Mon Sep 17 00:00:00 2001 From: Roger Peppe Date: Mon, 2 Sep 2024 18:47:17 +0100 Subject: [PATCH] encoding/jsonschema: implement "not" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change implements the "not" keyword using `matchN`. No test regressions were encountered when updating the external test data. One regression was encountered when updating the regular test data, and filed as a comment under issue #3422. This required updating the test data to get the test to pass. Signed-off-by: Roger Peppe Change-Id: Ib2537af7424895843eebc1b915bc643894637afa Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1200530 TryBot-Result: CUEcueckoo Unity-Result: CUE porcuepine Reviewed-by: Daniel Martí --- .../src/schemas/json/github-workflow.cue | 22 +- encoding/jsonschema/constraints.go | 1 + encoding/jsonschema/constraints_combinator.go | 12 + encoding/jsonschema/external_teststats.txt | 12 +- .../external/tests/draft2019-09/not.json | 220 +++--------------- .../draft2019-09/optional/unknownKeyword.json | 4 +- .../external/tests/draft2019-09/ref.json | 4 +- .../tests/draft2019-09/unevaluatedItems.json | 4 +- .../draft2019-09/unevaluatedProperties.json | 4 +- .../external/tests/draft2020-12/not.json | 220 +++--------------- .../draft2020-12/optional/unknownKeyword.json | 4 +- .../external/tests/draft2020-12/ref.json | 4 +- .../draft2020-12/unevaluatedProperties.json | 4 +- .../testdata/external/tests/draft4/not.json | 144 ++---------- .../testdata/external/tests/draft4/ref.json | 4 +- .../testdata/external/tests/draft6/not.json | 216 +++-------------- .../external/tests/draft6/optional/id.json | 32 +-- .../tests/draft6/optional/unknownKeyword.json | 4 +- .../testdata/external/tests/draft7/not.json | 216 +++-------------- .../tests/draft7/optional/unknownKeyword.json | 4 +- .../testdata/external/tests/draft7/ref.json | 4 +- .../testdata/txtar/unsupported.txtar | 11 +- 22 files changed, 222 insertions(+), 928 deletions(-) diff --git a/cue.mod/pkg/github.com/SchemaStore/schemastore/src/schemas/json/github-workflow.cue b/cue.mod/pkg/github.com/SchemaStore/schemastore/src/schemas/json/github-workflow.cue index 1a9ac266280..e5309520a30 100644 --- a/cue.mod/pkg/github.com/SchemaStore/schemastore/src/schemas/json/github-workflow.cue +++ b/cue.mod/pkg/github.com/SchemaStore/schemastore/src/schemas/json/github-workflow.cue @@ -624,7 +624,25 @@ import "strings" #path: #globs - #ref: null | { + #ref: matchN(1, [matchN(3, [matchN(0, [null | bool | number | string | [...] | { + branches!: _ + "branches-ignore"!: _ + ... + }]) & { + ... + }, matchN(0, [null | bool | number | string | [...] | { + tags!: _ + "tags-ignore"!: _ + ... + }]) & { + ... + }, matchN(0, [null | bool | number | string | [...] | { + paths!: _ + "paths-ignore"!: _ + ... + }]) & { + ... + }]), null]) & (null | { branches?: #branch "branches-ignore"?: #branch tags?: #branch @@ -632,7 +650,7 @@ import "strings" paths?: #path "paths-ignore"?: #path ... - } + }) #shell: matchN(>=1, [string, "bash" | "pwsh" | "python" | "sh" | "cmd" | "powershell"]) diff --git a/encoding/jsonschema/constraints.go b/encoding/jsonschema/constraints.go index ab7c14730d4..6c7743e84fa 100644 --- a/encoding/jsonschema/constraints.go +++ b/encoding/jsonschema/constraints.go @@ -88,6 +88,7 @@ var constraints = []*constraint{ p2("minLength", constraintMinLength), p3("minimum", constraintMinimum), p2("multipleOf", constraintMultipleOf), + p3("not", constraintNot), p3("oneOf", constraintOneOf), p2("nullable", constraintNullable), p2("pattern", constraintPattern), diff --git a/encoding/jsonschema/constraints_combinator.go b/encoding/jsonschema/constraints_combinator.go index 4b50000fa35..b2bb5e16431 100644 --- a/encoding/jsonschema/constraints_combinator.go +++ b/encoding/jsonschema/constraints_combinator.go @@ -136,3 +136,15 @@ func constraintOneOf(key string, n cue.Value, s *state) { // TODO: oneOf({a:x}, {b:y}, ..., not(anyOf({a:x}, {b:y}, ...))), // can be translated to {} | {a:x}, {b:y}, ... } + +func constraintNot(key string, n cue.Value, s *state) { + subSchema := s.schema(n) + s.all.add(n, ast.NewCall( + ast.NewIdent("matchN"), + &ast.BasicLit{ + Kind: token.INT, + Value: "0", + }, + ast.NewList(subSchema), + )) +} diff --git a/encoding/jsonschema/external_teststats.txt b/encoding/jsonschema/external_teststats.txt index 4bccdc3a692..e21760e9d16 100644 --- a/encoding/jsonschema/external_teststats.txt +++ b/encoding/jsonschema/external_teststats.txt @@ -1,10 +1,10 @@ # Generated by teststats. DO NOT EDIT v2: - schema extract (pass / total): 975 / 1637 = 59.6% - tests (pass / total): 3140 / 7175 = 43.8% - tests on extracted schemas (pass / total): 3140 / 3546 = 88.6% + schema extract (pass / total): 1015 / 1637 = 62.0% + tests (pass / total): 3308 / 7175 = 46.1% + tests on extracted schemas (pass / total): 3308 / 3722 = 88.9% v3: - schema extract (pass / total): 967 / 1637 = 59.1% - tests (pass / total): 3074 / 7175 = 42.8% - tests on extracted schemas (pass / total): 3074 / 3538 = 86.9% + schema extract (pass / total): 1003 / 1637 = 61.3% + tests (pass / total): 3214 / 7175 = 44.8% + tests on extracted schemas (pass / total): 3214 / 3678 = 87.4% diff --git a/encoding/jsonschema/testdata/external/tests/draft2019-09/not.json b/encoding/jsonschema/testdata/external/tests/draft2019-09/not.json index f15cbaee9c2..0f0ab74b246 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2019-09/not.json +++ b/encoding/jsonschema/testdata/external/tests/draft2019-09/not.json @@ -7,28 +7,16 @@ "type": "integer" } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "allowed", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "disallowed", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -43,37 +31,21 @@ ] } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "valid", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "mismatch", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "other mismatch", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -90,41 +62,25 @@ } } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "match", "data": 1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "other match", "data": { "foo": 1 }, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "mismatch", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -138,10 +94,6 @@ } } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "property present", @@ -149,11 +101,7 @@ "foo": 1, "bar": 2 }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "property absent", @@ -161,11 +109,7 @@ "bar": 1, "baz": 2 }, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -175,95 +119,55 @@ "$schema": "https://json-schema.org/draft/2019-09/schema", "not": {} }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "number is invalid", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "string is invalid", "data": "foo", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean true is invalid", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean false is invalid", "data": false, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "null is invalid", "data": null, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "object is invalid", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty object is invalid", "data": {}, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "array is invalid", "data": [ "foo" ], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty array is invalid", "data": [], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -273,95 +177,55 @@ "$schema": "https://json-schema.org/draft/2019-09/schema", "not": true }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "number is invalid", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "string is invalid", "data": "foo", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean true is invalid", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean false is invalid", "data": false, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "null is invalid", "data": null, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "object is invalid", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty object is invalid", "data": {}, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "array is invalid", "data": [ "foo" ], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty array is invalid", "data": [], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -372,8 +236,7 @@ "not": false }, "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" + "v3": "extract error: cannot compile resulting schema: explicit error (_|_ literal) in source:\n generated.cue:2:12\n" }, "tests": [ { @@ -381,7 +244,6 @@ "data": 1, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -390,7 +252,6 @@ "data": "foo", "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -399,7 +260,6 @@ "data": true, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -408,7 +268,6 @@ "data": false, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -417,7 +276,6 @@ "data": null, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -428,7 +286,6 @@ }, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -437,7 +294,6 @@ "data": {}, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -448,7 +304,7 @@ ], "valid": true, "skip": { - "v2": "could not compile schema", + "v2": "invalid value [\"foo\"] (does not satisfy matchN(0, _|_(explicit error (_|_ literal) in source))): 0 matched, expected 0:\n generated.cue:2:1\n generated.cue:1:1\n generated.cue:2:8\n instance.json:1:1\n", "v3": "could not compile schema" } }, @@ -457,7 +313,7 @@ "data": [], "valid": true, "skip": { - "v2": "could not compile schema", + "v2": "invalid value [] (does not satisfy matchN(0, _|_(explicit error (_|_ literal) in source))): 0 matched, expected 0:\n generated.cue:2:1\n generated.cue:1:1\n generated.cue:2:8\n instance.json:1:1\n", "v3": "could not compile schema" } } @@ -471,19 +327,11 @@ "not": {} } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "any value is valid", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -505,8 +353,8 @@ } }, "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" + "v2": "extract error: unsupported constraint \"unevaluatedProperties\"", + "v3": "extract error: unsupported constraint \"unevaluatedProperties\"" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft2019-09/optional/unknownKeyword.json b/encoding/jsonschema/testdata/external/tests/draft2019-09/optional/unknownKeyword.json index e10e5644abe..8ff3f8725ab 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2019-09/optional/unknownKeyword.json +++ b/encoding/jsonschema/testdata/external/tests/draft2019-09/optional/unknownKeyword.json @@ -43,8 +43,8 @@ ] }, "skip": { - "v2": "extract error: unsupported constraint \"not\" (and 1 more errors)", - "v3": "extract error: unsupported constraint \"not\" (and 1 more errors)" + "v2": "extract error: unsupported constraint \"array_of_schemas\" (and 1 more errors)", + "v3": "extract error: unsupported constraint \"array_of_schemas\" (and 1 more errors)" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft2019-09/ref.json b/encoding/jsonschema/testdata/external/tests/draft2019-09/ref.json index c67f0ce1731..2c872cf9488 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2019-09/ref.json +++ b/encoding/jsonschema/testdata/external/tests/draft2019-09/ref.json @@ -849,8 +849,8 @@ ] }, "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" + "v2": "extract error: cannot compile resulting schema: package \"example.com/b/d.json:d\" imported but not defined in :\n generated.cue:1:8\n", + "v3": "extract error: cannot compile resulting schema: package \"example.com/b/d.json:d\" imported but not defined in :\n generated.cue:1:8\n" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedItems.json b/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedItems.json index 136b0f6a173..0e3889dd64f 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedItems.json +++ b/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedItems.json @@ -683,8 +683,8 @@ "unevaluatedItems": false }, "skip": { - "v2": "extract error: unsupported constraint \"not\" (and 1 more errors)", - "v3": "extract error: unsupported constraint \"not\" (and 1 more errors)" + "v2": "extract error: unsupported constraint \"unevaluatedItems\"", + "v3": "extract error: unsupported constraint \"unevaluatedItems\"" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedProperties.json b/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedProperties.json index eef87e26d4f..e92eb256e4e 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedProperties.json +++ b/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedProperties.json @@ -639,8 +639,8 @@ "unevaluatedProperties": false }, "skip": { - "v2": "extract error: unsupported constraint \"not\" (and 1 more errors)", - "v3": "extract error: unsupported constraint \"not\" (and 1 more errors)" + "v2": "extract error: unsupported constraint \"unevaluatedProperties\"", + "v3": "extract error: unsupported constraint \"unevaluatedProperties\"" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft2020-12/not.json b/encoding/jsonschema/testdata/external/tests/draft2020-12/not.json index 21956368ddc..487a64bb474 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2020-12/not.json +++ b/encoding/jsonschema/testdata/external/tests/draft2020-12/not.json @@ -7,28 +7,16 @@ "type": "integer" } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "allowed", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "disallowed", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -43,37 +31,21 @@ ] } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "valid", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "mismatch", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "other mismatch", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -90,41 +62,25 @@ } } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "match", "data": 1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "other match", "data": { "foo": 1 }, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "mismatch", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -138,10 +94,6 @@ } } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "property present", @@ -149,11 +101,7 @@ "foo": 1, "bar": 2 }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "property absent", @@ -161,11 +109,7 @@ "bar": 1, "baz": 2 }, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -175,95 +119,55 @@ "$schema": "https://json-schema.org/draft/2020-12/schema", "not": {} }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "number is invalid", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "string is invalid", "data": "foo", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean true is invalid", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean false is invalid", "data": false, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "null is invalid", "data": null, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "object is invalid", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty object is invalid", "data": {}, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "array is invalid", "data": [ "foo" ], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty array is invalid", "data": [], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -273,95 +177,55 @@ "$schema": "https://json-schema.org/draft/2020-12/schema", "not": true }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "number is invalid", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "string is invalid", "data": "foo", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean true is invalid", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean false is invalid", "data": false, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "null is invalid", "data": null, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "object is invalid", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty object is invalid", "data": {}, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "array is invalid", "data": [ "foo" ], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty array is invalid", "data": [], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -372,8 +236,7 @@ "not": false }, "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" + "v3": "extract error: cannot compile resulting schema: explicit error (_|_ literal) in source:\n generated.cue:2:12\n" }, "tests": [ { @@ -381,7 +244,6 @@ "data": 1, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -390,7 +252,6 @@ "data": "foo", "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -399,7 +260,6 @@ "data": true, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -408,7 +268,6 @@ "data": false, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -417,7 +276,6 @@ "data": null, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -428,7 +286,6 @@ }, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -437,7 +294,6 @@ "data": {}, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -448,7 +304,7 @@ ], "valid": true, "skip": { - "v2": "could not compile schema", + "v2": "invalid value [\"foo\"] (does not satisfy matchN(0, _|_(explicit error (_|_ literal) in source))): 0 matched, expected 0:\n generated.cue:2:1\n generated.cue:1:1\n generated.cue:2:8\n instance.json:1:1\n", "v3": "could not compile schema" } }, @@ -457,7 +313,7 @@ "data": [], "valid": true, "skip": { - "v2": "could not compile schema", + "v2": "invalid value [] (does not satisfy matchN(0, _|_(explicit error (_|_ literal) in source))): 0 matched, expected 0:\n generated.cue:2:1\n generated.cue:1:1\n generated.cue:2:8\n instance.json:1:1\n", "v3": "could not compile schema" } } @@ -471,19 +327,11 @@ "not": {} } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "any value is valid", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -505,8 +353,8 @@ } }, "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" + "v2": "extract error: unsupported constraint \"unevaluatedProperties\"", + "v3": "extract error: unsupported constraint \"unevaluatedProperties\"" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft2020-12/optional/unknownKeyword.json b/encoding/jsonschema/testdata/external/tests/draft2020-12/optional/unknownKeyword.json index 3b205a67f33..07479c6575e 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2020-12/optional/unknownKeyword.json +++ b/encoding/jsonschema/testdata/external/tests/draft2020-12/optional/unknownKeyword.json @@ -43,8 +43,8 @@ ] }, "skip": { - "v2": "extract error: unsupported constraint \"not\" (and 1 more errors)", - "v3": "extract error: unsupported constraint \"not\" (and 1 more errors)" + "v2": "extract error: unsupported constraint \"array_of_schemas\" (and 1 more errors)", + "v3": "extract error: unsupported constraint \"array_of_schemas\" (and 1 more errors)" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft2020-12/ref.json b/encoding/jsonschema/testdata/external/tests/draft2020-12/ref.json index 8c8054da623..951b2030338 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2020-12/ref.json +++ b/encoding/jsonschema/testdata/external/tests/draft2020-12/ref.json @@ -849,8 +849,8 @@ ] }, "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" + "v2": "extract error: cannot compile resulting schema: package \"example.com/b/d.json:d\" imported but not defined in :\n generated.cue:1:8\n", + "v3": "extract error: cannot compile resulting schema: package \"example.com/b/d.json:d\" imported but not defined in :\n generated.cue:1:8\n" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft2020-12/unevaluatedProperties.json b/encoding/jsonschema/testdata/external/tests/draft2020-12/unevaluatedProperties.json index 0dbe4a1bd0d..6ff809d68a1 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2020-12/unevaluatedProperties.json +++ b/encoding/jsonschema/testdata/external/tests/draft2020-12/unevaluatedProperties.json @@ -639,8 +639,8 @@ "unevaluatedProperties": false }, "skip": { - "v2": "extract error: unsupported constraint \"not\" (and 1 more errors)", - "v3": "extract error: unsupported constraint \"not\" (and 1 more errors)" + "v2": "extract error: unsupported constraint \"unevaluatedProperties\"", + "v3": "extract error: unsupported constraint \"unevaluatedProperties\"" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft4/not.json b/encoding/jsonschema/testdata/external/tests/draft4/not.json index 1d9fdbee579..9bf987bce6f 100644 --- a/encoding/jsonschema/testdata/external/tests/draft4/not.json +++ b/encoding/jsonschema/testdata/external/tests/draft4/not.json @@ -6,28 +6,16 @@ "type": "integer" } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "allowed", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "disallowed", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -41,37 +29,21 @@ ] } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "valid", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "mismatch", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "other mismatch", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -87,41 +59,25 @@ } } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "match", "data": 1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "other match", "data": { "foo": 1 }, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "mismatch", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -134,10 +90,6 @@ } } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "property present", @@ -145,11 +97,7 @@ "foo": 1, "bar": 2 }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "property absent", @@ -157,11 +105,7 @@ "bar": 1, "baz": 2 }, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -170,95 +114,55 @@ "schema": { "not": {} }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "number is invalid", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "string is invalid", "data": "foo", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean true is invalid", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean false is invalid", "data": false, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "null is invalid", "data": null, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "object is invalid", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty object is invalid", "data": {}, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "array is invalid", "data": [ "foo" ], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty array is invalid", "data": [], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -269,19 +173,11 @@ "not": {} } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "any value is valid", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] } diff --git a/encoding/jsonschema/testdata/external/tests/draft4/ref.json b/encoding/jsonschema/testdata/external/tests/draft4/ref.json index 0259ee17fba..693040ad903 100644 --- a/encoding/jsonschema/testdata/external/tests/draft4/ref.json +++ b/encoding/jsonschema/testdata/external/tests/draft4/ref.json @@ -749,8 +749,8 @@ ] }, "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" + "v2": "extract error: cannot compile resulting schema: package \"example.com/b/d.json:d\" imported but not defined in :\n generated.cue:1:8\n", + "v3": "extract error: cannot compile resulting schema: package \"example.com/b/d.json:d\" imported but not defined in :\n generated.cue:1:8\n" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft6/not.json b/encoding/jsonschema/testdata/external/tests/draft6/not.json index 5ec504d1d8d..caf19839c76 100644 --- a/encoding/jsonschema/testdata/external/tests/draft6/not.json +++ b/encoding/jsonschema/testdata/external/tests/draft6/not.json @@ -6,28 +6,16 @@ "type": "integer" } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "allowed", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "disallowed", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -41,37 +29,21 @@ ] } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "valid", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "mismatch", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "other mismatch", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -87,41 +59,25 @@ } } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "match", "data": 1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "other match", "data": { "foo": 1 }, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "mismatch", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -134,10 +90,6 @@ } } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "property present", @@ -145,11 +97,7 @@ "foo": 1, "bar": 2 }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "property absent", @@ -157,11 +105,7 @@ "bar": 1, "baz": 2 }, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -170,95 +114,55 @@ "schema": { "not": {} }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "number is invalid", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "string is invalid", "data": "foo", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean true is invalid", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean false is invalid", "data": false, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "null is invalid", "data": null, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "object is invalid", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty object is invalid", "data": {}, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "array is invalid", "data": [ "foo" ], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty array is invalid", "data": [], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -267,95 +171,55 @@ "schema": { "not": true }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "number is invalid", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "string is invalid", "data": "foo", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean true is invalid", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean false is invalid", "data": false, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "null is invalid", "data": null, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "object is invalid", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty object is invalid", "data": {}, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "array is invalid", "data": [ "foo" ], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty array is invalid", "data": [], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -365,8 +229,7 @@ "not": false }, "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" + "v3": "extract error: cannot compile resulting schema: explicit error (_|_ literal) in source:\n generated.cue:2:12\n" }, "tests": [ { @@ -374,7 +237,6 @@ "data": 1, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -383,7 +245,6 @@ "data": "foo", "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -392,7 +253,6 @@ "data": true, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -401,7 +261,6 @@ "data": false, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -410,7 +269,6 @@ "data": null, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -421,7 +279,6 @@ }, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -430,7 +287,6 @@ "data": {}, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -441,7 +297,7 @@ ], "valid": true, "skip": { - "v2": "could not compile schema", + "v2": "invalid value [\"foo\"] (does not satisfy matchN(0, _|_(explicit error (_|_ literal) in source))): 0 matched, expected 0:\n generated.cue:2:1\n generated.cue:2:8\n instance.json:1:1\n", "v3": "could not compile schema" } }, @@ -450,7 +306,7 @@ "data": [], "valid": true, "skip": { - "v2": "could not compile schema", + "v2": "invalid value [] (does not satisfy matchN(0, _|_(explicit error (_|_ literal) in source))): 0 matched, expected 0:\n generated.cue:2:1\n generated.cue:2:8\n instance.json:1:1\n", "v3": "could not compile schema" } } @@ -463,19 +319,11 @@ "not": {} } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "any value is valid", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] } diff --git a/encoding/jsonschema/testdata/external/tests/draft6/optional/id.json b/encoding/jsonschema/testdata/external/tests/draft6/optional/id.json index 26f6dac57c4..1992be3c8e6 100644 --- a/encoding/jsonschema/testdata/external/tests/draft6/optional/id.json +++ b/encoding/jsonschema/testdata/external/tests/draft6/optional/id.json @@ -97,28 +97,16 @@ } ] }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "skip traversing definition for a valid result", "data": "skip not_a_real_anchor", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "const at const_not_anchor does not match", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -150,28 +138,16 @@ } ] }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "skip traversing definition for a valid result", "data": "skip not_a_real_id", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "const at const_not_id does not match", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] } diff --git a/encoding/jsonschema/testdata/external/tests/draft6/optional/unknownKeyword.json b/encoding/jsonschema/testdata/external/tests/draft6/optional/unknownKeyword.json index 509e4141700..f665e4afd0f 100644 --- a/encoding/jsonschema/testdata/external/tests/draft6/optional/unknownKeyword.json +++ b/encoding/jsonschema/testdata/external/tests/draft6/optional/unknownKeyword.json @@ -42,8 +42,8 @@ ] }, "skip": { - "v2": "extract error: unsupported constraint \"not\" (and 1 more errors)", - "v3": "extract error: unsupported constraint \"not\" (and 1 more errors)" + "v2": "extract error: unsupported constraint \"array_of_schemas\" (and 1 more errors)", + "v3": "extract error: unsupported constraint \"array_of_schemas\" (and 1 more errors)" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft7/not.json b/encoding/jsonschema/testdata/external/tests/draft7/not.json index 5ec504d1d8d..caf19839c76 100644 --- a/encoding/jsonschema/testdata/external/tests/draft7/not.json +++ b/encoding/jsonschema/testdata/external/tests/draft7/not.json @@ -6,28 +6,16 @@ "type": "integer" } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "allowed", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "disallowed", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -41,37 +29,21 @@ ] } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "valid", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "mismatch", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "other mismatch", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -87,41 +59,25 @@ } } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "match", "data": 1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "other match", "data": { "foo": 1 }, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "mismatch", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -134,10 +90,6 @@ } } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "property present", @@ -145,11 +97,7 @@ "foo": 1, "bar": 2 }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "property absent", @@ -157,11 +105,7 @@ "bar": 1, "baz": 2 }, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -170,95 +114,55 @@ "schema": { "not": {} }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "number is invalid", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "string is invalid", "data": "foo", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean true is invalid", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean false is invalid", "data": false, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "null is invalid", "data": null, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "object is invalid", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty object is invalid", "data": {}, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "array is invalid", "data": [ "foo" ], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty array is invalid", "data": [], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -267,95 +171,55 @@ "schema": { "not": true }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "number is invalid", "data": 1, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "string is invalid", "data": "foo", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean true is invalid", "data": true, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "boolean false is invalid", "data": false, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "null is invalid", "data": null, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "object is invalid", "data": { "foo": "bar" }, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty object is invalid", "data": {}, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "array is invalid", "data": [ "foo" ], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "empty array is invalid", "data": [], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -365,8 +229,7 @@ "not": false }, "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" + "v3": "extract error: cannot compile resulting schema: explicit error (_|_ literal) in source:\n generated.cue:2:12\n" }, "tests": [ { @@ -374,7 +237,6 @@ "data": 1, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -383,7 +245,6 @@ "data": "foo", "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -392,7 +253,6 @@ "data": true, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -401,7 +261,6 @@ "data": false, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -410,7 +269,6 @@ "data": null, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -421,7 +279,6 @@ }, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -430,7 +287,6 @@ "data": {}, "valid": true, "skip": { - "v2": "could not compile schema", "v3": "could not compile schema" } }, @@ -441,7 +297,7 @@ ], "valid": true, "skip": { - "v2": "could not compile schema", + "v2": "invalid value [\"foo\"] (does not satisfy matchN(0, _|_(explicit error (_|_ literal) in source))): 0 matched, expected 0:\n generated.cue:2:1\n generated.cue:2:8\n instance.json:1:1\n", "v3": "could not compile schema" } }, @@ -450,7 +306,7 @@ "data": [], "valid": true, "skip": { - "v2": "could not compile schema", + "v2": "invalid value [] (does not satisfy matchN(0, _|_(explicit error (_|_ literal) in source))): 0 matched, expected 0:\n generated.cue:2:1\n generated.cue:2:8\n instance.json:1:1\n", "v3": "could not compile schema" } } @@ -463,19 +319,11 @@ "not": {} } }, - "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" - }, "tests": [ { "description": "any value is valid", "data": "foo", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] } diff --git a/encoding/jsonschema/testdata/external/tests/draft7/optional/unknownKeyword.json b/encoding/jsonschema/testdata/external/tests/draft7/optional/unknownKeyword.json index 509e4141700..f665e4afd0f 100644 --- a/encoding/jsonschema/testdata/external/tests/draft7/optional/unknownKeyword.json +++ b/encoding/jsonschema/testdata/external/tests/draft7/optional/unknownKeyword.json @@ -42,8 +42,8 @@ ] }, "skip": { - "v2": "extract error: unsupported constraint \"not\" (and 1 more errors)", - "v3": "extract error: unsupported constraint \"not\" (and 1 more errors)" + "v2": "extract error: unsupported constraint \"array_of_schemas\" (and 1 more errors)", + "v3": "extract error: unsupported constraint \"array_of_schemas\" (and 1 more errors)" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft7/ref.json b/encoding/jsonschema/testdata/external/tests/draft7/ref.json index cebd1a68420..d14402b483c 100644 --- a/encoding/jsonschema/testdata/external/tests/draft7/ref.json +++ b/encoding/jsonschema/testdata/external/tests/draft7/ref.json @@ -1005,8 +1005,8 @@ ] }, "skip": { - "v2": "extract error: unsupported constraint \"not\"", - "v3": "extract error: unsupported constraint \"not\"" + "v2": "extract error: cannot compile resulting schema: package \"example.com/b/d.json:d\" imported but not defined in :\n generated.cue:1:8\n", + "v3": "extract error: cannot compile resulting schema: package \"example.com/b/d.json:d\" imported but not defined in :\n generated.cue:1:8\n" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/txtar/unsupported.txtar b/encoding/jsonschema/testdata/txtar/unsupported.txtar index 560bbcf460f..f1c0143b488 100644 --- a/encoding/jsonschema/testdata/txtar/unsupported.txtar +++ b/encoding/jsonschema/testdata/txtar/unsupported.txtar @@ -17,10 +17,7 @@ "allOf": [ { "not": { - "required": [ - "branches", - "branches-ignore" - ] + "type": "string" } } ] @@ -38,7 +35,9 @@ @jsonschema(schema="http://json-schema.org/draft-07/schema#") _ -#ref: null | { +#ref: matchN(1, [matchN(1, [matchN(0, [string]) & { + ... +}]), null]) & (null | { branches?: { ... } @@ -46,4 +45,4 @@ _ ... } ... -} +})