Skip to content

Commit

Permalink
encoding/jsonschema: add test case for issue 3351
Browse files Browse the repository at this point in the history
This test case works with the current evaluator,
but currently panics with CUE_EXPERIMENT=evalv3.

For #3351.

Signed-off-by: Daniel Martí <[email protected]>
Change-Id: I1fc4050296d4269feb60ffab76341a1d75d87551
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198735
Reviewed-by: Roger Peppe <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
  • Loading branch information
mvdan committed Aug 1, 2024
1 parent 44bc1ab commit 95c818c
Showing 1 changed file with 93 additions and 0 deletions.
93 changes: 93 additions & 0 deletions encoding/jsonschema/testdata/issue3351.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
-- json-e.json --
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "https://www.sourcemeta.com/schemas/vendor/[email protected]",
"$comment": "https://json-e.js.org",
"$defs": {
"jsone-value": {
"oneOf": [
{
"$ref": "#"
},
{
"type": "array",
"items": {
"$ref": "#"
}
}
]
},
"jsone-array": {
"type": "array",
"items": {
"$ref": "#/$defs/jsone-value"
}
},
"jsone-object-array": {
"type": "array",
"items": {
"$ref": "#"
}
}
},
"additionalProperties": {
"$ref": "#/$defs/jsone-value"
},
"properties": {
"$else": {
"$ref": "#/$defs/jsone-value"
},
"$let": {
"type": "object",
"additionalProperties": {
"additionalProperties": {
"$ref": "#"
}
}
},
"$sort": {
"anyOf": [
{
"$ref": "#"
},
{
"type": "array",
"items": {
"type": "number"
}
}
]
}
},
"title": "JSON-e templates",
"type": "object"
}
-- out/decode/cue --
_schema
_schema: {
// JSON-e templates
@jsonschema(schema="https://json-schema.org/draft/2019-09/schema")
@jsonschema(id="https://www.sourcemeta.com/schemas/vendor/[email protected]")
$else?: #["jsone-value"]
$let?: [string]: null | bool | number | string | [...] | {
[string]: _schema_1
}
$sort?: (_schema_5 | [...number]) & _
{[!~"^($else|$let|$sort)$"]: #["jsone-value"]}

#: "jsone-value": _schema_A | [..._schema_8]

#: "jsone-array": [...#["jsone-value"]]

#: "jsone-object-array": [..._schema_E]
}

let _schema_1 = _schema

let _schema_5 = _schema

let _schema_A = _schema

let _schema_8 = _schema

let _schema_E = _schema

0 comments on commit 95c818c

Please sign in to comment.