-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
encoding/jsonschema: more consistent test data
Currently the tests in `encoding/jsonschema` can have any name for the schema file, and the output file is ignored if there's an error. In preparation for adding some actual verification tests, change the convention so the schema file is always named `schema.json` or `schema.yaml` and the output is always placed into `out/decode/extract`, so there's no chance of confusion as to what the actual test result is. Signed-off-by: Roger Peppe <[email protected]> Change-Id: Ie49110a0e27bf0792162791a0da39b7081952f81 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199737 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
- Loading branch information
Showing
32 changed files
with
124 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
-- type.json -- | ||
-- schema.json -- | ||
{ | ||
"anyOf": [ | ||
true, | ||
false | ||
] | ||
} | ||
|
||
-- out/decode/cue -- | ||
-- out/decode/extract -- | ||
_ | _|_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
-- type.json -- | ||
-- schema.json -- | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"anyOf": [true] | ||
} | ||
|
||
-- out/decode/err -- | ||
-- out/decode/extract -- | ||
ERROR: | ||
boolean schemas not supported in http://json-schema.org/draft-04/schema#: | ||
type.json:3:12 | ||
schema.json:3:12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
-- type.json -- | ||
-- schema.json -- | ||
{ | ||
"$defs": { | ||
"foo": true | ||
}, | ||
"$ref": "#/$defs/foo", | ||
"type": "string" | ||
} | ||
-- out/decode/cue -- | ||
-- out/decode/extract -- | ||
#foo & string | ||
|
||
#foo: _ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
-- type.json -- | ||
-- schema.json -- | ||
{ | ||
"type": "array", | ||
"const": [ | ||
1 | ||
] | ||
} | ||
|
||
-- out/decode/cue -- | ||
-- out/decode/extract -- | ||
[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
|
||
-- type.json -- | ||
-- schema.json -- | ||
{ | ||
"type": "object", | ||
"const": {"a": 1} | ||
} | ||
|
||
-- out/decode/cue -- | ||
-- out/decode/extract -- | ||
a: 1 | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
-- type.json -- | ||
-- schema.json -- | ||
{ | ||
"type": "object", | ||
"enum": ["x"] | ||
} | ||
-- out/decode/err -- | ||
-- out/decode/extract -- | ||
ERROR: | ||
constraints are not possible to satisfy: | ||
type.json:1:1 | ||
schema.json:1:1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
-- type.json -- | ||
-- schema.json -- | ||
{ | ||
"allOf": [ | ||
{ "type": "object" }, | ||
{ "type": "string" } | ||
] | ||
} | ||
-- out/decode/err -- | ||
-- out/decode/extract -- | ||
ERROR: | ||
constraints are not possible to satisfy: | ||
type.json:1:1 | ||
schema.json:1:1 | ||
constraints are not possible to satisfy: | ||
type.json:4:9 | ||
schema.json:4:9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
-- json-e.json -- | ||
-- schema.json -- | ||
{ | ||
"$schema": "https://json-schema.org/draft/2019-09/schema", | ||
"$id": "https://www.sourcemeta.com/schemas/vendor/[email protected]", | ||
|
@@ -62,7 +62,7 @@ | |
"title": "JSON-e templates", | ||
"type": "object" | ||
} | ||
-- out/decode/cue -- | ||
-- out/decode/extract -- | ||
_schema | ||
_schema: { | ||
// JSON-e templates | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
#strict | ||
-- definition.json -- | ||
-- schema.json -- | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"$id": "http://example.test", | ||
"type": "string" | ||
} | ||
-- out/decode/err -- | ||
-- out/decode/extract -- | ||
ERROR: | ||
constraint "$id" is not supported in JSON schema version http://json-schema.org/draft-04/schema#: | ||
definition.json:3:3 | ||
schema.json:3:3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.