cuelang.org/go@v0.13.0/encoding/jsonschema/testdata/txtar/def.txtar (about) 1 // This test tests the conversion and ordering of definitions. 2 3 -- schema.json -- 4 { 5 "$schema": "http://json-schema.org/draft-07/schema#", 6 7 "$id": "http://cuelang.org/go/encoding/openapi/testdata/order.json", 8 9 "definitions": { 10 "address": { 11 "type": "object", 12 "properties": { 13 "street_address": { "type": "string" }, 14 "city": { "type": "string" }, 15 "state": { "type": "string" } 16 }, 17 "required": ["street_address", "city", "state"] 18 }, 19 "per-son": { 20 "type": "object", 21 "properties": { 22 "name": { "type": "string" }, 23 "children": { 24 "type": "array", 25 "items": { "$ref": "#/definitions/per-son" }, 26 "default": [] 27 } 28 } 29 } 30 }, 31 32 "type": "object", 33 34 "properties": { 35 "person": { "$ref": "#/definitions/per-son" }, 36 "billing_address": { "$ref": "#/definitions/address" }, 37 "shipping_address": { "$ref": "#/definitions/address" } 38 } 39 } 40 41 -- out/decode/extract -- 42 @jsonschema(schema="http://json-schema.org/draft-07/schema#") 43 @jsonschema(id="http://cuelang.org/go/encoding/openapi/testdata/order.json") 44 person?: #."per-son" 45 billing_address?: #address 46 shipping_address?: #address 47 48 #: "per-son": { 49 name?: string 50 children?: [...#."per-son"] 51 ... 52 } 53 54 #address: { 55 street_address!: string 56 city!: string 57 state!: string 58 ... 59 } 60 ...