cuelang.org/go@v0.10.1/encoding/jsonschema/testdata/def.txtar (about) 1 // This test tests the conversion and ordering of definitions. 2 3 -- definition.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/cue -- 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 #address: { 49 street_address!: string 50 city!: string 51 state!: string 52 ... 53 } 54 55 #: "per-son": { 56 name?: string 57 children?: [...#["per-son"]] 58 ... 59 } 60 ...