| 1 | { |
| 2 | "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 3 | "title": "My Amazing Struct", |
| 4 | "description": "This struct shows off generating a schema with\na custom title and description.", |
| 5 | "type": "object", |
| 6 | "properties": { |
| 7 | "my_bool": { |
| 8 | "description": "This bool has a description, but no title.", |
| 9 | "type": "boolean" |
| 10 | }, |
| 11 | "my_int": { |
| 12 | "title": "My Amazing Integer", |
| 13 | "type": "integer", |
| 14 | "format": "int32" |
| 15 | }, |
| 16 | "my_nullable_enum": { |
| 17 | "title": "A Nullable Enum", |
| 18 | "description": "This enum might be set, or it might not.", |
| 19 | "anyOf": [ |
| 20 | { |
| 21 | "$ref": "#/$defs/MyEnum" |
| 22 | }, |
| 23 | { |
| 24 | "type": "null" |
| 25 | } |
| 26 | ] |
| 27 | } |
| 28 | }, |
| 29 | "required": [ |
| 30 | "my_int", |
| 31 | "my_bool" |
| 32 | ], |
| 33 | "$defs": { |
| 34 | "MyEnum": { |
| 35 | "title": "My Amazing Enum", |
| 36 | "oneOf": [ |
| 37 | { |
| 38 | "description": "A wrapper around a `String`", |
| 39 | "type": "object", |
| 40 | "properties": { |
| 41 | "StringNewType": { |
| 42 | "type": "string" |
| 43 | } |
| 44 | }, |
| 45 | "additionalProperties": false, |
| 46 | "required": [ |
| 47 | "StringNewType" |
| 48 | ] |
| 49 | }, |
| 50 | { |
| 51 | "description": "A struct-like enum variant which contains\nsome floats", |
| 52 | "type": "object", |
| 53 | "properties": { |
| 54 | "StructVariant": { |
| 55 | "type": "object", |
| 56 | "properties": { |
| 57 | "floats": { |
| 58 | "description": "The floats themselves", |
| 59 | "type": "array", |
| 60 | "items": { |
| 61 | "type": "number", |
| 62 | "format": "float" |
| 63 | } |
| 64 | } |
| 65 | }, |
| 66 | "required": [ |
| 67 | "floats" |
| 68 | ] |
| 69 | } |
| 70 | }, |
| 71 | "additionalProperties": false, |
| 72 | "required": [ |
| 73 | "StructVariant" |
| 74 | ] |
| 75 | } |
| 76 | ] |
| 77 | } |
| 78 | } |
| 79 | } |