Skip to content

Commit 95c818c

Browse files
committed
encoding/jsonschema: add test case for issue 3351
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]>
1 parent 44bc1ab commit 95c818c

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
-- json-e.json --
2+
{
3+
"$schema": "https://json-schema.org/draft/2019-09/schema",
4+
"$id": "https://www.sourcemeta.com/schemas/vendor/[email protected]",
5+
"$comment": "https://json-e.js.org",
6+
"$defs": {
7+
"jsone-value": {
8+
"oneOf": [
9+
{
10+
"$ref": "#"
11+
},
12+
{
13+
"type": "array",
14+
"items": {
15+
"$ref": "#"
16+
}
17+
}
18+
]
19+
},
20+
"jsone-array": {
21+
"type": "array",
22+
"items": {
23+
"$ref": "#/$defs/jsone-value"
24+
}
25+
},
26+
"jsone-object-array": {
27+
"type": "array",
28+
"items": {
29+
"$ref": "#"
30+
}
31+
}
32+
},
33+
"additionalProperties": {
34+
"$ref": "#/$defs/jsone-value"
35+
},
36+
"properties": {
37+
"$else": {
38+
"$ref": "#/$defs/jsone-value"
39+
},
40+
"$let": {
41+
"type": "object",
42+
"additionalProperties": {
43+
"additionalProperties": {
44+
"$ref": "#"
45+
}
46+
}
47+
},
48+
"$sort": {
49+
"anyOf": [
50+
{
51+
"$ref": "#"
52+
},
53+
{
54+
"type": "array",
55+
"items": {
56+
"type": "number"
57+
}
58+
}
59+
]
60+
}
61+
},
62+
"title": "JSON-e templates",
63+
"type": "object"
64+
}
65+
-- out/decode/cue --
66+
_schema
67+
_schema: {
68+
// JSON-e templates
69+
@jsonschema(schema="https://json-schema.org/draft/2019-09/schema")
70+
@jsonschema(id="https://www.sourcemeta.com/schemas/vendor/[email protected]")
71+
$else?: #["jsone-value"]
72+
$let?: [string]: null | bool | number | string | [...] | {
73+
[string]: _schema_1
74+
}
75+
$sort?: (_schema_5 | [...number]) & _
76+
{[!~"^($else|$let|$sort)$"]: #["jsone-value"]}
77+
78+
#: "jsone-value": _schema_A | [..._schema_8]
79+
80+
#: "jsone-array": [...#["jsone-value"]]
81+
82+
#: "jsone-object-array": [..._schema_E]
83+
}
84+
85+
let _schema_1 = _schema
86+
87+
let _schema_5 = _schema
88+
89+
let _schema_A = _schema
90+
91+
let _schema_8 = _schema
92+
93+
let _schema_E = _schema

0 commit comments

Comments
 (0)