| // This test tests the conversion and ordering of definitions. |
| |
| -- definition.json -- |
| { |
| "$schema": "http://json-schema.org/draft-07/schema#", |
| |
| "$id": "http://cuelang.org/go/encoding/openapi/testdata/order.json", |
| |
| "definitions": { |
| "address": { |
| "type": "object", |
| "properties": { |
| "street_address": { "type": "string" }, |
| "city": { "type": "string" }, |
| "state": { "type": "string" } |
| }, |
| "required": ["street_address", "city", "state"] |
| }, |
| "per-son": { |
| "type": "object", |
| "properties": { |
| "name": { "type": "string" }, |
| "children": { |
| "type": "array", |
| "items": { "$ref": "#/definitions/per-son" }, |
| "default": [] |
| } |
| } |
| } |
| }, |
| |
| "type": "object", |
| |
| "properties": { |
| "person": { "$ref": "#/definitions/per-son" }, |
| "billing_address": { "$ref": "#/definitions/address" }, |
| "shipping_address": { "$ref": "#/definitions/address" } |
| } |
| } |
| |
| -- out.cue -- |
| @jsonschema(schema="http://json-schema.org/draft-07/schema#") |
| @jsonschema(id="http://cuelang.org/go/encoding/openapi/testdata/order.json") |
| person?: #["per-son"] |
| billing_address?: #address |
| shipping_address?: #address |
| |
| #address: { |
| street_address: string |
| city: string |
| state: string |
| ... |
| } |
| |
| #: "per-son": { |
| name?: string |
| children?: [...#["per-son"]] |
| ... |
| } |
| ... |