cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/txtar/basic.txtar (about) 1 -- schema.json -- 2 { 3 "$schema": "https://json-schema.org/draft/2019-09/schema", 4 "type": "object", 5 "title": "Main schema", 6 "description": "Specify who you are and all.", 7 "$defs": { 8 "address": { 9 "description": "address stores a postal address", 10 "type": "string", 11 "minLength": 4, 12 "maxLength": 20 13 }, 14 "phone number": { 15 "description": "a telephone number", 16 "type": "string" 17 } 18 }, 19 "properties": { 20 "person": { 21 "description": "A person is a human being.", 22 "type": "object", 23 "required": [ 24 "name" 25 ], 26 "properties": { 27 "name": { 28 "type": "string", 29 "examples": [ 30 "foo" 31 ] 32 }, 33 "address": { 34 "description": "where does this person live?", 35 "$ref": "#/$defs/address" 36 }, 37 "children": { 38 "description": "A very large comment that will be wrapped after a certain line length. Let's keep on going and see what happens.", 39 "type": "array", 40 "items": { 41 "type": "string" 42 }, 43 "default": [] 44 }, 45 "home phone": { 46 "$ref": "#/$defs/phone number", 47 "deprecated": true 48 } 49 } 50 } 51 } 52 } 53 -- out/decode/extract -- 54 // Main schema 55 // 56 // Specify who you are and all. 57 58 import "strings" 59 60 @jsonschema(schema="https://json-schema.org/draft/2019-09/schema") 61 62 // A person is a human being. 63 person?: { 64 name!: string 65 66 // where does this person live? 67 address?: #address 68 69 // A very large comment that will be wrapped after a certain line 70 // length. Let's keep on going and see what happens. 71 children?: [...string] 72 "home phone"?: #."phone number" @deprecated() 73 ... 74 } 75 76 // a telephone number 77 #: "phone number": string 78 79 // address stores a postal address 80 #address: strings.MinRunes(4) & strings.MaxRunes(20) 81 ...