From 7648cbd25d923d937c4be18c4d5efcb1c25738bd Mon Sep 17 00:00:00 2001 From: Roger Peppe Date: Tue, 10 Sep 2024 13:59:56 +0100 Subject: [PATCH] encoding/jsonschema: implement if/then/else keywords MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the newly added `matchIf` builtin to implement the JSON Schema conditional operator. Signed-off-by: Roger Peppe Change-Id: I0a64a67683d573f4bc348fb6704f7b18ac3339a7 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1200945 TryBot-Result: CUEcueckoo Reviewed-by: Daniel Martí Unity-Result: CUE porcuepine --- .../src/schemas/json/github-workflow.cue | 32 ++- encoding/jsonschema/constraints.go | 6 +- encoding/jsonschema/constraints_combinator.go | 12 ++ encoding/jsonschema/decode.go | 23 +++ encoding/jsonschema/external_teststats.txt | 12 +- .../external/tests/draft2019-09/contains.json | 14 +- .../tests/draft2019-09/if-then-else.json | 184 +++--------------- .../tests/draft2019-09/recursiveRef.json | 8 +- .../external/tests/draft2019-09/ref.json | 12 +- .../tests/draft2019-09/unevaluatedItems.json | 8 +- .../draft2019-09/unevaluatedProperties.json | 16 +- .../external/tests/draft2020-12/contains.json | 14 +- .../tests/draft2020-12/dynamicRef.json | 8 +- .../tests/draft2020-12/if-then-else.json | 184 +++--------------- .../external/tests/draft2020-12/ref.json | 12 +- .../tests/draft2020-12/unevaluatedItems.json | 8 +- .../draft2020-12/unevaluatedProperties.json | 16 +- .../external/tests/draft7/contains.json | 14 +- .../external/tests/draft7/if-then-else.json | 184 +++--------------- .../external/tests/draft7/optional/id.json | 32 +-- .../testdata/external/tests/draft7/ref.json | 12 +- 21 files changed, 216 insertions(+), 595 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 e7fefb24262..3c5d5b8a317 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 @@ -394,7 +394,37 @@ import ( // converted to lowercase during runtime. We recommended using // lowercase input ids. inputs?: { - {[=~"^[_a-zA-Z][a-zA-Z0-9_-]*$" & !~"^()$"]: { + {[=~"^[_a-zA-Z][a-zA-Z0-9_-]*$" & !~"^()$"]: matchN(5, [matchIf(null | bool | number | string | [...] | { + type!: "string", ... + }, null | bool | number | string | [...] | { + default?: string, ... + }, _) & { + ... + }, matchIf(null | bool | number | string | [...] | { + type!: "boolean", ... + }, null | bool | number | string | [...] | { + default?: bool, ... + }, _) & { + ... + }, matchIf(null | bool | number | string | [...] | { + type!: "number", ... + }, null | bool | number | string | [...] | { + default?: number, ... + }, _) & { + ... + }, matchIf(null | bool | number | string | [...] | { + type!: "environment", ... + }, null | bool | number | string | [...] | { + default?: string, ... + }, _) & { + ... + }, matchIf(null | bool | number | string | [...] | { + type!: "choice", ... + }, null | bool | number | string | [...] | { + options!: _, ... + }, _) & { + ... + }]) & { // A string description of the input parameter. description!: string diff --git a/encoding/jsonschema/constraints.go b/encoding/jsonschema/constraints.go index 7e4c0223833..77df52eb3ea 100644 --- a/encoding/jsonschema/constraints.go +++ b/encoding/jsonschema/constraints.go @@ -90,7 +90,7 @@ var constraints = []*constraint{ p2("deprecated", constraintDeprecated, vfrom(VersionDraft2019_09)|openAPI), p2("description", constraintDescription, allVersions|openAPI), p1("discriminator", constraintTODO, openAPI), - p1("else", constraintTODO, vfrom(VersionDraft7)), + p1("else", constraintElse, vfrom(VersionDraft7)), p2("enum", constraintEnum, allVersions|openAPI), p1("example", constraintTODO, openAPI), p2("examples", constraintExamples, vfrom(VersionDraft6)), @@ -99,7 +99,7 @@ var constraints = []*constraint{ p1("externalDocs", constraintTODO, openAPI), p1("format", constraintTODO, allVersions|openAPI), p1("id", constraintID, vto(VersionDraft4)), - p1("if", constraintTODO, vfrom(VersionDraft7)), + p1("if", constraintIf, vfrom(VersionDraft7)), p2("items", constraintItems, allVersions|openAPI), p1("maxContains", constraintMaxContains, vfrom(VersionDraft2019_09)), p2("maxItems", constraintMaxItems, allVersions|openAPI), @@ -122,7 +122,7 @@ var constraints = []*constraint{ p2("propertyNames", constraintPropertyNames, vfrom(VersionDraft6)), p1("readOnly", constraintTODO, vfrom(VersionDraft7)|openAPI), p3("required", constraintRequired, allVersions|openAPI), - p1("then", constraintTODO, vfrom(VersionDraft7)), + p1("then", constraintThen, vfrom(VersionDraft7)), p2("title", constraintTitle, allVersions|openAPI), p2("type", constraintType, allVersions|openAPI), p1("unevaluatedItems", constraintTODO, vfrom(VersionDraft2019_09)), diff --git a/encoding/jsonschema/constraints_combinator.go b/encoding/jsonschema/constraints_combinator.go index b2bb5e16431..7eefcdae00c 100644 --- a/encoding/jsonschema/constraints_combinator.go +++ b/encoding/jsonschema/constraints_combinator.go @@ -148,3 +148,15 @@ func constraintNot(key string, n cue.Value, s *state) { ast.NewList(subSchema), )) } + +func constraintIf(key string, n cue.Value, s *state) { + s.ifConstraint = s.schema(n) +} + +func constraintThen(key string, n cue.Value, s *state) { + s.thenConstraint = s.schema(n) +} + +func constraintElse(key string, n cue.Value, s *state) { + s.elseConstraint = s.schema(n) +} diff --git a/encoding/jsonschema/decode.go b/encoding/jsonschema/decode.go index 3a975b60122..674af07a281 100644 --- a/encoding/jsonschema/decode.go +++ b/encoding/jsonschema/decode.go @@ -385,6 +385,10 @@ type state struct { minContains *uint64 maxContains *uint64 + ifConstraint ast.Expr + thenConstraint ast.Expr + elseConstraint ast.Expr + schemaVersion Version schemaVersionPresent bool @@ -459,6 +463,7 @@ func (s *state) finalize() (e ast.Expr) { s.addErr(errors.Newf(s.pos.Pos(), "constraints are not possible to satisfy")) return bottom() } + s.addIfThenElse() conjuncts := []ast.Expr{} disjuncts := []ast.Expr{} @@ -608,6 +613,24 @@ outer: return e } +func (s *state) addIfThenElse() { + if s.ifConstraint == nil || (s.thenConstraint == nil && s.elseConstraint == nil) { + return + } + if s.thenConstraint == nil { + s.thenConstraint = top() + } + if s.elseConstraint == nil { + s.elseConstraint = top() + } + s.all.add(s.pos, ast.NewCall( + ast.NewIdent("matchIf"), + s.ifConstraint, + s.thenConstraint, + s.elseConstraint, + )) +} + func (s *state) comment() *ast.CommentGroup { // Create documentation. doc := strings.TrimSpace(s.title) diff --git a/encoding/jsonschema/external_teststats.txt b/encoding/jsonschema/external_teststats.txt index 445442bef33..175ca323e1e 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): 1040 / 1637 = 63.5% - tests (pass / total): 3378 / 7175 = 47.1% - tests on extracted schemas (pass / total): 3378 / 3792 = 89.1% + schema extract (pass / total): 1072 / 1637 = 65.5% + tests (pass / total): 3457 / 7175 = 48.2% + tests on extracted schemas (pass / total): 3457 / 3874 = 89.2% v3: - schema extract (pass / total): 1028 / 1637 = 62.8% - tests (pass / total): 3329 / 7175 = 46.4% - tests on extracted schemas (pass / total): 3329 / 3748 = 88.8% + schema extract (pass / total): 1060 / 1637 = 64.8% + tests (pass / total): 3408 / 7175 = 47.5% + tests on extracted schemas (pass / total): 3408 / 3830 = 89.0% diff --git a/encoding/jsonschema/testdata/external/tests/draft2019-09/contains.json b/encoding/jsonschema/testdata/external/tests/draft2019-09/contains.json index eefbf381c14..842beccb8eb 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2019-09/contains.json +++ b/encoding/jsonschema/testdata/external/tests/draft2019-09/contains.json @@ -201,10 +201,6 @@ "else": true } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 1 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 1 more errors)" - }, "tests": [ { "description": "any non-empty array is valid", @@ -213,18 +209,14 @@ ], "valid": true, "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" + "v2": "6 errors in empty disjunction:\nconflicting values [\"foo\"] and {...} (mismatched types list and struct):\n generated.cue:4:1\n generated.cue:4:72\n instance.json:1:1\nconflicting values bool and [\"foo\"] (mismatched types bool and list):\n generated.cue:4:8\n instance.json:1:1\nconflicting values null and [\"foo\"] (mismatched types null and list):\n generated.cue:4:1\n instance.json:1:1\nconflicting values number and [\"foo\"] (mismatched types number and list):\n generated.cue:4:15\n instance.json:1:1\nconflicting values string and [\"foo\"] (mismatched types string and list):\n generated.cue:4:24\n instance.json:1:1\nexplicit error (_|_ literal) in source:\n generated.cue:4:58\n", + "v3": "conflicting values [\"foo\"] and {...} (mismatched types list and struct):\n generated.cue:4:72\n instance.json:1:1\nconflicting values bool and [\"foo\"] (mismatched types bool and list):\n generated.cue:4:8\n instance.json:1:1\nconflicting values null and [\"foo\"] (mismatched types null and list):\n generated.cue:4:1\n instance.json:1:1\nconflicting values number and [\"foo\"] (mismatched types number and list):\n generated.cue:4:15\n instance.json:1:1\nconflicting values string and [\"foo\"] (mismatched types string and list):\n generated.cue:4:24\n instance.json:1:1\nexplicit error (_|_ literal) in source:\n generated.cue:4:58\n" } }, { "description": "empty array is invalid", "data": [], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, diff --git a/encoding/jsonschema/testdata/external/tests/draft2019-09/if-then-else.json b/encoding/jsonschema/testdata/external/tests/draft2019-09/if-then-else.json index 0efc92e6274..c411c6daec4 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2019-09/if-then-else.json +++ b/encoding/jsonschema/testdata/external/tests/draft2019-09/if-then-else.json @@ -7,28 +7,16 @@ "const": 0 } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented", - "v3": "extract error: keyword \"if\" not yet implemented" - }, "tests": [ { "description": "valid when valid against lone if", "data": 0, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid when invalid against lone if", "data": "hello", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -40,28 +28,16 @@ "const": 0 } }, - "skip": { - "v2": "extract error: keyword \"then\" not yet implemented", - "v3": "extract error: keyword \"then\" not yet implemented" - }, "tests": [ { "description": "valid when valid against lone then", "data": 0, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid when invalid against lone then", "data": "hello", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -73,28 +49,16 @@ "const": 0 } }, - "skip": { - "v2": "extract error: keyword \"else\" not yet implemented", - "v3": "extract error: keyword \"else\" not yet implemented" - }, "tests": [ { "description": "valid when valid against lone else", "data": 0, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid when invalid against lone else", "data": "hello", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -109,37 +73,21 @@ "minimum": -10 } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 1 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 1 more errors)" - }, "tests": [ { "description": "valid through then", "data": -1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "invalid through then", "data": -100, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "valid when if test fails", "data": 3, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -154,37 +102,21 @@ "multipleOf": 2 } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 1 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 1 more errors)" - }, "tests": [ { "description": "valid when if test passes", "data": -1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid through else", "data": 4, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "invalid through else", "data": 3, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -202,46 +134,26 @@ "multipleOf": 2 } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" - }, "tests": [ { "description": "valid through then", "data": -1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "invalid through then", "data": -100, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "valid through else", "data": 4, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "invalid through else", "data": 3, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -267,28 +179,16 @@ } ] }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" - }, "tests": [ { "description": "valid, but would have been invalid through then", "data": -100, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid, but would have been invalid through else", "data": 3, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -304,28 +204,16 @@ "const": "else" } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" - }, "tests": [ { "description": "boolean schema true in if always chooses the then path (valid)", "data": "then", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "boolean schema true in if always chooses the then path (invalid)", "data": "else", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -342,8 +230,8 @@ } }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" + "v2": "extract error: cannot compile resulting schema: explicit error (_|_ literal) in source:\n generated.cue:2:9\n", + "v3": "extract error: cannot compile resulting schema: explicit error (_|_ literal) in source:\n generated.cue:2:9\n" }, "tests": [ { @@ -380,46 +268,26 @@ "maxLength": 4 } }, - "skip": { - "v2": "extract error: keyword \"then\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"then\" not yet implemented (and 2 more errors)" - }, "tests": [ { "description": "yes redirects to then and passes", "data": "yes", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "other redirects to else and passes", "data": "other", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "no redirects to then and fails", "data": "no", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "invalid redirects to else and fails", "data": "invalid", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] } diff --git a/encoding/jsonschema/testdata/external/tests/draft2019-09/recursiveRef.json b/encoding/jsonschema/testdata/external/tests/draft2019-09/recursiveRef.json index 33ac79e5a66..58d3200bc56 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2019-09/recursiveRef.json +++ b/encoding/jsonschema/testdata/external/tests/draft2019-09/recursiveRef.json @@ -632,8 +632,8 @@ } }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 4 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 4 more errors)" + "v2": "extract error: keyword \"$recursiveAnchor\" not yet implemented (and 3 more errors)", + "v3": "extract error: keyword \"$recursiveAnchor\" not yet implemented (and 3 more errors)" }, "tests": [ { @@ -698,8 +698,8 @@ } }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 4 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 4 more errors)" + "v2": "extract error: keyword \"$recursiveAnchor\" not yet implemented (and 3 more errors)", + "v3": "extract error: keyword \"$recursiveAnchor\" not yet implemented (and 3 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 ef1f42a2cf2..b193ae0f014 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2019-09/ref.json +++ b/encoding/jsonschema/testdata/external/tests/draft2019-09/ref.json @@ -1256,8 +1256,8 @@ } }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented", - "v3": "extract error: keyword \"if\" not yet implemented" + "v2": "extract error: cannot compile resulting schema: package \"example.com/ref/if\" imported but not defined in :\n generated.cue:1:8\n", + "v3": "extract error: cannot compile resulting schema: package \"example.com/ref/if\" imported but not defined in :\n generated.cue:1:8\n" }, "tests": [ { @@ -1291,8 +1291,8 @@ } }, "skip": { - "v2": "extract error: keyword \"then\" not yet implemented", - "v3": "extract error: keyword \"then\" not yet implemented" + "v2": "extract error: cannot compile resulting schema: package \"example.com/ref/then\" imported but not defined in :\n generated.cue:1:8\n", + "v3": "extract error: cannot compile resulting schema: package \"example.com/ref/then\" imported but not defined in :\n generated.cue:1:8\n" }, "tests": [ { @@ -1326,8 +1326,8 @@ } }, "skip": { - "v2": "extract error: keyword \"else\" not yet implemented", - "v3": "extract error: keyword \"else\" not yet implemented" + "v2": "extract error: cannot compile resulting schema: package \"example.com/ref/else\" imported but not defined in :\n generated.cue:1:8\n", + "v3": "extract error: cannot compile resulting schema: package \"example.com/ref/else\" 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 c0a7edfb76a..ba8926fa0b8 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedItems.json +++ b/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedItems.json @@ -740,8 +740,8 @@ "unevaluatedItems": false }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 3 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 3 more errors)" + "v2": "extract error: keyword \"unevaluatedItems\" not yet implemented", + "v3": "extract error: keyword \"unevaluatedItems\" not yet implemented" }, "tests": [ { @@ -1223,8 +1223,8 @@ "unevaluatedItems": false }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 1 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 1 more errors)" + "v2": "extract error: keyword \"unevaluatedItems\" not yet implemented", + "v3": "extract error: keyword \"unevaluatedItems\" not yet implemented" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedProperties.json b/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedProperties.json index 2cfd663711b..723a970e90a 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedProperties.json +++ b/encoding/jsonschema/testdata/external/tests/draft2019-09/unevaluatedProperties.json @@ -695,8 +695,8 @@ "unevaluatedProperties": false }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 3 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 3 more errors)" + "v2": "extract error: keyword \"unevaluatedProperties\" not yet implemented", + "v3": "extract error: keyword \"unevaluatedProperties\" not yet implemented" }, "tests": [ { @@ -777,8 +777,8 @@ "unevaluatedProperties": false }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" + "v2": "extract error: keyword \"unevaluatedProperties\" not yet implemented", + "v3": "extract error: keyword \"unevaluatedProperties\" not yet implemented" }, "tests": [ { @@ -859,8 +859,8 @@ "unevaluatedProperties": false }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" + "v2": "extract error: keyword \"unevaluatedProperties\" not yet implemented", + "v3": "extract error: keyword \"unevaluatedProperties\" not yet implemented" }, "tests": [ { @@ -2456,8 +2456,8 @@ "unevaluatedProperties": false }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 1 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 1 more errors)" + "v2": "extract error: keyword \"unevaluatedProperties\" not yet implemented", + "v3": "extract error: keyword \"unevaluatedProperties\" not yet implemented" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft2020-12/contains.json b/encoding/jsonschema/testdata/external/tests/draft2020-12/contains.json index 430a26d17ac..b54659fc16b 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2020-12/contains.json +++ b/encoding/jsonschema/testdata/external/tests/draft2020-12/contains.json @@ -201,10 +201,6 @@ "else": true } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 1 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 1 more errors)" - }, "tests": [ { "description": "any non-empty array is valid", @@ -213,18 +209,14 @@ ], "valid": true, "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" + "v2": "6 errors in empty disjunction:\nconflicting values [\"foo\"] and {...} (mismatched types list and struct):\n generated.cue:4:1\n generated.cue:4:72\n instance.json:1:1\nconflicting values bool and [\"foo\"] (mismatched types bool and list):\n generated.cue:4:8\n instance.json:1:1\nconflicting values null and [\"foo\"] (mismatched types null and list):\n generated.cue:4:1\n instance.json:1:1\nconflicting values number and [\"foo\"] (mismatched types number and list):\n generated.cue:4:15\n instance.json:1:1\nconflicting values string and [\"foo\"] (mismatched types string and list):\n generated.cue:4:24\n instance.json:1:1\nexplicit error (_|_ literal) in source:\n generated.cue:4:58\n", + "v3": "conflicting values [\"foo\"] and {...} (mismatched types list and struct):\n generated.cue:4:72\n instance.json:1:1\nconflicting values bool and [\"foo\"] (mismatched types bool and list):\n generated.cue:4:8\n instance.json:1:1\nconflicting values null and [\"foo\"] (mismatched types null and list):\n generated.cue:4:1\n instance.json:1:1\nconflicting values number and [\"foo\"] (mismatched types number and list):\n generated.cue:4:15\n instance.json:1:1\nconflicting values string and [\"foo\"] (mismatched types string and list):\n generated.cue:4:24\n instance.json:1:1\nexplicit error (_|_ literal) in source:\n generated.cue:4:58\n" } }, { "description": "empty array is invalid", "data": [], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, diff --git a/encoding/jsonschema/testdata/external/tests/draft2020-12/dynamicRef.json b/encoding/jsonschema/testdata/external/tests/draft2020-12/dynamicRef.json index bf88db1483c..18e436180ed 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2020-12/dynamicRef.json +++ b/encoding/jsonschema/testdata/external/tests/draft2020-12/dynamicRef.json @@ -645,8 +645,8 @@ } }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 6 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 6 more errors)" + "v2": "extract error: keyword \"$dynamicRef\" not yet implemented (and 3 more errors)", + "v3": "extract error: keyword \"$dynamicRef\" not yet implemented (and 3 more errors)" }, "tests": [ { @@ -748,8 +748,8 @@ } }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 3 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 3 more errors)" + "v2": "extract error: keyword \"$dynamicAnchor\" not yet implemented (and 3 more errors)", + "v3": "extract error: keyword \"$dynamicAnchor\" not yet implemented (and 3 more errors)" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft2020-12/if-then-else.json b/encoding/jsonschema/testdata/external/tests/draft2020-12/if-then-else.json index 5edbcfda693..781beed9020 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2020-12/if-then-else.json +++ b/encoding/jsonschema/testdata/external/tests/draft2020-12/if-then-else.json @@ -7,28 +7,16 @@ "const": 0 } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented", - "v3": "extract error: keyword \"if\" not yet implemented" - }, "tests": [ { "description": "valid when valid against lone if", "data": 0, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid when invalid against lone if", "data": "hello", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -40,28 +28,16 @@ "const": 0 } }, - "skip": { - "v2": "extract error: keyword \"then\" not yet implemented", - "v3": "extract error: keyword \"then\" not yet implemented" - }, "tests": [ { "description": "valid when valid against lone then", "data": 0, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid when invalid against lone then", "data": "hello", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -73,28 +49,16 @@ "const": 0 } }, - "skip": { - "v2": "extract error: keyword \"else\" not yet implemented", - "v3": "extract error: keyword \"else\" not yet implemented" - }, "tests": [ { "description": "valid when valid against lone else", "data": 0, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid when invalid against lone else", "data": "hello", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -109,37 +73,21 @@ "minimum": -10 } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 1 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 1 more errors)" - }, "tests": [ { "description": "valid through then", "data": -1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "invalid through then", "data": -100, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "valid when if test fails", "data": 3, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -154,37 +102,21 @@ "multipleOf": 2 } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 1 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 1 more errors)" - }, "tests": [ { "description": "valid when if test passes", "data": -1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid through else", "data": 4, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "invalid through else", "data": 3, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -202,46 +134,26 @@ "multipleOf": 2 } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" - }, "tests": [ { "description": "valid through then", "data": -1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "invalid through then", "data": -100, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "valid through else", "data": 4, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "invalid through else", "data": 3, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -267,28 +179,16 @@ } ] }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" - }, "tests": [ { "description": "valid, but would have been invalid through then", "data": -100, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid, but would have been invalid through else", "data": 3, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -304,28 +204,16 @@ "const": "else" } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" - }, "tests": [ { "description": "boolean schema true in if always chooses the then path (valid)", "data": "then", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "boolean schema true in if always chooses the then path (invalid)", "data": "else", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -342,8 +230,8 @@ } }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" + "v2": "extract error: cannot compile resulting schema: explicit error (_|_ literal) in source:\n generated.cue:2:9\n", + "v3": "extract error: cannot compile resulting schema: explicit error (_|_ literal) in source:\n generated.cue:2:9\n" }, "tests": [ { @@ -380,46 +268,26 @@ "maxLength": 4 } }, - "skip": { - "v2": "extract error: keyword \"then\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"then\" not yet implemented (and 2 more errors)" - }, "tests": [ { "description": "yes redirects to then and passes", "data": "yes", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "other redirects to else and passes", "data": "other", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "no redirects to then and fails", "data": "no", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "invalid redirects to else and fails", "data": "invalid", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] } diff --git a/encoding/jsonschema/testdata/external/tests/draft2020-12/ref.json b/encoding/jsonschema/testdata/external/tests/draft2020-12/ref.json index d3a4fba2b78..92eef044f2e 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2020-12/ref.json +++ b/encoding/jsonschema/testdata/external/tests/draft2020-12/ref.json @@ -1256,8 +1256,8 @@ } }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented", - "v3": "extract error: keyword \"if\" not yet implemented" + "v2": "extract error: cannot compile resulting schema: package \"example.com/ref/if\" imported but not defined in :\n generated.cue:1:8\n", + "v3": "extract error: cannot compile resulting schema: package \"example.com/ref/if\" imported but not defined in :\n generated.cue:1:8\n" }, "tests": [ { @@ -1291,8 +1291,8 @@ } }, "skip": { - "v2": "extract error: keyword \"then\" not yet implemented", - "v3": "extract error: keyword \"then\" not yet implemented" + "v2": "extract error: cannot compile resulting schema: package \"example.com/ref/then\" imported but not defined in :\n generated.cue:1:8\n", + "v3": "extract error: cannot compile resulting schema: package \"example.com/ref/then\" imported but not defined in :\n generated.cue:1:8\n" }, "tests": [ { @@ -1326,8 +1326,8 @@ } }, "skip": { - "v2": "extract error: keyword \"else\" not yet implemented", - "v3": "extract error: keyword \"else\" not yet implemented" + "v2": "extract error: cannot compile resulting schema: package \"example.com/ref/else\" imported but not defined in :\n generated.cue:1:8\n", + "v3": "extract error: cannot compile resulting schema: package \"example.com/ref/else\" imported but not defined in :\n generated.cue:1:8\n" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft2020-12/unevaluatedItems.json b/encoding/jsonschema/testdata/external/tests/draft2020-12/unevaluatedItems.json index b5bef2e6831..0e6f058dd5a 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2020-12/unevaluatedItems.json +++ b/encoding/jsonschema/testdata/external/tests/draft2020-12/unevaluatedItems.json @@ -1203,8 +1203,8 @@ "unevaluatedItems": false }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" + "v2": "extract error: keyword \"unevaluatedItems\" not yet implemented", + "v3": "extract error: keyword \"unevaluatedItems\" not yet implemented" }, "tests": [ { @@ -1422,8 +1422,8 @@ "unevaluatedItems": false }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 1 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 1 more errors)" + "v2": "extract error: keyword \"prefixItems\" not yet implemented (and 1 more errors)", + "v3": "extract error: keyword \"prefixItems\" not yet implemented (and 1 more errors)" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft2020-12/unevaluatedProperties.json b/encoding/jsonschema/testdata/external/tests/draft2020-12/unevaluatedProperties.json index 9235f763a76..7eee3f7b3e3 100644 --- a/encoding/jsonschema/testdata/external/tests/draft2020-12/unevaluatedProperties.json +++ b/encoding/jsonschema/testdata/external/tests/draft2020-12/unevaluatedProperties.json @@ -695,8 +695,8 @@ "unevaluatedProperties": false }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 3 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 3 more errors)" + "v2": "extract error: keyword \"unevaluatedProperties\" not yet implemented", + "v3": "extract error: keyword \"unevaluatedProperties\" not yet implemented" }, "tests": [ { @@ -777,8 +777,8 @@ "unevaluatedProperties": false }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" + "v2": "extract error: keyword \"unevaluatedProperties\" not yet implemented", + "v3": "extract error: keyword \"unevaluatedProperties\" not yet implemented" }, "tests": [ { @@ -859,8 +859,8 @@ "unevaluatedProperties": false }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" + "v2": "extract error: keyword \"unevaluatedProperties\" not yet implemented", + "v3": "extract error: keyword \"unevaluatedProperties\" not yet implemented" }, "tests": [ { @@ -2453,8 +2453,8 @@ "unevaluatedProperties": false }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 1 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 1 more errors)" + "v2": "extract error: keyword \"unevaluatedProperties\" not yet implemented", + "v3": "extract error: keyword \"unevaluatedProperties\" not yet implemented" }, "tests": [ { diff --git a/encoding/jsonschema/testdata/external/tests/draft7/contains.json b/encoding/jsonschema/testdata/external/tests/draft7/contains.json index f7b529c629c..07bc0d92724 100644 --- a/encoding/jsonschema/testdata/external/tests/draft7/contains.json +++ b/encoding/jsonschema/testdata/external/tests/draft7/contains.json @@ -195,10 +195,6 @@ "else": true } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 1 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 1 more errors)" - }, "tests": [ { "description": "any non-empty array is valid", @@ -207,18 +203,14 @@ ], "valid": true, "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" + "v2": "6 errors in empty disjunction:\nconflicting values [\"foo\"] and {...} (mismatched types list and struct):\n generated.cue:3:1\n generated.cue:3:72\n instance.json:1:1\nconflicting values bool and [\"foo\"] (mismatched types bool and list):\n generated.cue:3:8\n instance.json:1:1\nconflicting values null and [\"foo\"] (mismatched types null and list):\n generated.cue:3:1\n instance.json:1:1\nconflicting values number and [\"foo\"] (mismatched types number and list):\n generated.cue:3:15\n instance.json:1:1\nconflicting values string and [\"foo\"] (mismatched types string and list):\n generated.cue:3:24\n instance.json:1:1\nexplicit error (_|_ literal) in source:\n generated.cue:3:58\n", + "v3": "conflicting values [\"foo\"] and {...} (mismatched types list and struct):\n generated.cue:3:72\n instance.json:1:1\nconflicting values bool and [\"foo\"] (mismatched types bool and list):\n generated.cue:3:8\n instance.json:1:1\nconflicting values null and [\"foo\"] (mismatched types null and list):\n generated.cue:3:1\n instance.json:1:1\nconflicting values number and [\"foo\"] (mismatched types number and list):\n generated.cue:3:15\n instance.json:1:1\nconflicting values string and [\"foo\"] (mismatched types string and list):\n generated.cue:3:24\n instance.json:1:1\nexplicit error (_|_ literal) in source:\n generated.cue:3:58\n" } }, { "description": "empty array is invalid", "data": [], - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, diff --git a/encoding/jsonschema/testdata/external/tests/draft7/if-then-else.json b/encoding/jsonschema/testdata/external/tests/draft7/if-then-else.json index 263709fa9e1..6525730ea10 100644 --- a/encoding/jsonschema/testdata/external/tests/draft7/if-then-else.json +++ b/encoding/jsonschema/testdata/external/tests/draft7/if-then-else.json @@ -6,28 +6,16 @@ "const": 0 } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented", - "v3": "extract error: keyword \"if\" not yet implemented" - }, "tests": [ { "description": "valid when valid against lone if", "data": 0, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid when invalid against lone if", "data": "hello", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -38,28 +26,16 @@ "const": 0 } }, - "skip": { - "v2": "extract error: keyword \"then\" not yet implemented", - "v3": "extract error: keyword \"then\" not yet implemented" - }, "tests": [ { "description": "valid when valid against lone then", "data": 0, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid when invalid against lone then", "data": "hello", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -70,28 +46,16 @@ "const": 0 } }, - "skip": { - "v2": "extract error: keyword \"else\" not yet implemented", - "v3": "extract error: keyword \"else\" not yet implemented" - }, "tests": [ { "description": "valid when valid against lone else", "data": 0, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid when invalid against lone else", "data": "hello", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -105,37 +69,21 @@ "minimum": -10 } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 1 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 1 more errors)" - }, "tests": [ { "description": "valid through then", "data": -1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "invalid through then", "data": -100, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "valid when if test fails", "data": 3, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -149,37 +97,21 @@ "multipleOf": 2 } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 1 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 1 more errors)" - }, "tests": [ { "description": "valid when if test passes", "data": -1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid through else", "data": 4, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "invalid through else", "data": 3, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -196,46 +128,26 @@ "multipleOf": 2 } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" - }, "tests": [ { "description": "valid through then", "data": -1, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "invalid through then", "data": -100, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "valid through else", "data": 4, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "invalid through else", "data": 3, - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -260,28 +172,16 @@ } ] }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" - }, "tests": [ { "description": "valid, but would have been invalid through then", "data": -100, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "valid, but would have been invalid through else", "data": 3, - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true } ] }, @@ -296,28 +196,16 @@ "const": "else" } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" - }, "tests": [ { "description": "boolean schema true in if always chooses the then path (valid)", "data": "then", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "boolean schema true in if always chooses the then path (invalid)", "data": "else", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] }, @@ -333,8 +221,8 @@ } }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" + "v2": "extract error: cannot compile resulting schema: explicit error (_|_ literal) in source:\n generated.cue:2:9\n", + "v3": "extract error: cannot compile resulting schema: explicit error (_|_ literal) in source:\n generated.cue:2:9\n" }, "tests": [ { @@ -370,46 +258,26 @@ "maxLength": 4 } }, - "skip": { - "v2": "extract error: keyword \"then\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"then\" not yet implemented (and 2 more errors)" - }, "tests": [ { "description": "yes redirects to then and passes", "data": "yes", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "other redirects to else and passes", "data": "other", - "valid": true, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": true }, { "description": "no redirects to then and fails", "data": "no", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false }, { "description": "invalid redirects to else and fails", "data": "invalid", - "valid": false, - "skip": { - "v2": "could not compile schema", - "v3": "could not compile schema" - } + "valid": false } ] } diff --git a/encoding/jsonschema/testdata/external/tests/draft7/optional/id.json b/encoding/jsonschema/testdata/external/tests/draft7/optional/id.json index 62bf951fa54..daf8079878e 100644 --- a/encoding/jsonschema/testdata/external/tests/draft7/optional/id.json +++ b/encoding/jsonschema/testdata/external/tests/draft7/optional/id.json @@ -87,28 +87,16 @@ "$ref": "#/definitions/const_not_anchor" } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" - }, "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 } ] }, @@ -130,28 +118,16 @@ "$ref": "#/definitions/const_not_id" } }, - "skip": { - "v2": "extract error: keyword \"if\" not yet implemented (and 2 more errors)", - "v3": "extract error: keyword \"if\" not yet implemented (and 2 more errors)" - }, "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/draft7/ref.json b/encoding/jsonschema/testdata/external/tests/draft7/ref.json index 98f50956ad9..ed19078a480 100644 --- a/encoding/jsonschema/testdata/external/tests/draft7/ref.json +++ b/encoding/jsonschema/testdata/external/tests/draft7/ref.json @@ -1283,8 +1283,8 @@ ] }, "skip": { - "v2": "extract error: keyword \"if\" not yet implemented", - "v3": "extract error: keyword \"if\" not yet implemented" + "v2": "extract error: cannot compile resulting schema: expected operand, found ']':\n generated.cue:3:14\n", + "v3": "extract error: cannot compile resulting schema: expected operand, found ']':\n generated.cue:3:14\n" }, "tests": [ { @@ -1323,8 +1323,8 @@ ] }, "skip": { - "v2": "extract error: keyword \"then\" not yet implemented", - "v3": "extract error: keyword \"then\" not yet implemented" + "v2": "extract error: cannot compile resulting schema: package \"example.com/ref/then\" imported but not defined in :\n generated.cue:1:8\n", + "v3": "extract error: cannot compile resulting schema: package \"example.com/ref/then\" imported but not defined in :\n generated.cue:1:8\n" }, "tests": [ { @@ -1363,8 +1363,8 @@ ] }, "skip": { - "v2": "extract error: keyword \"else\" not yet implemented", - "v3": "extract error: keyword \"else\" not yet implemented" + "v2": "extract error: cannot compile resulting schema: package \"example.com/ref/else\" imported but not defined in :\n generated.cue:1:8\n", + "v3": "extract error: cannot compile resulting schema: package \"example.com/ref/else\" imported but not defined in :\n generated.cue:1:8\n" }, "tests": [ {