...
1-- type.json --
2{
3 "type": "object",
4
5 "properties": {
6 "constant": { "const": 2 },
7 "several": {
8 "enum": [ 1, 2, 3, 4 ]
9 },
10 "inclusive": {
11 "type": "number",
12 "minimum": 2,
13 "maximum": 3
14 },
15 "exclusive": {
16 "type": "integer",
17 "exclusiveMinimum": 2,
18 "exclusiveMaximum": 3
19 },
20 "multi": {
21 "type": [ "integer", "string" ],
22 "minimum": 2,
23 "maximum": 3,
24 "maxLength": 5
25 },
26 "legacy": {
27 "type": "number",
28 "exclusiveMinimum": true,
29 "minimum": 2,
30 "exclusiveMaximum": true,
31 "maximum": 3
32 },
33 "cents": {
34 "type": "number",
35 "multipleOf": 0.05
36 }
37 },
38 "additionalProperties": false
39}
40
41-- out.cue --
42import (
43 "strings"
44 "math"
45)
46
47constant?: 2
48several?: 1 | 2 | 3 | 4
49inclusive?: >=2 & <=3
50exclusive?: int & >2 & <3
51multi?: int & >=2 & <=3 | strings.MaxRunes(5)
52legacy?: >2 & <3
53cents?: math.MultipleOf(0.05)
View as plain text