| -- type.json -- |
| { |
| "type": "object", |
| |
| "properties": { |
| "constant": { "const": 2 }, |
| "several": { |
| "enum": [ 1, 2, 3, 4 ] |
| }, |
| "inclusive": { |
| "type": "number", |
| "minimum": 2, |
| "maximum": 3 |
| }, |
| "exclusive": { |
| "type": "integer", |
| "exclusiveMinimum": 2, |
| "exclusiveMaximum": 3 |
| }, |
| "multi": { |
| "type": [ "integer", "string" ], |
| "minimum": 2, |
| "maximum": 3, |
| "maxLength": 5 |
| }, |
| "legacy": { |
| "type": "number", |
| "exclusiveMinimum": true, |
| "minimum": 2, |
| "exclusiveMaximum": true, |
| "maximum": 3 |
| }, |
| "cents": { |
| "type": "number", |
| "multipleOf": 0.05 |
| } |
| }, |
| "additionalProperties": false |
| } |
| |
| -- out.cue -- |
| import ( |
| "strings" |
| "math" |
| ) |
| |
| constant?: 2 |
| several?: 1 | 2 | 3 | 4 |
| inclusive?: >=2 & <=3 |
| exclusive?: int & >2 & <3 |
| multi?: int & >=2 & <=3 | strings.MaxRunes(5) |
| legacy?: >2 & <3 |
| cents?: math.MultipleOf(0.05) |