79 lines
1.9 KiB
JSON
79 lines
1.9 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"title": "My Amazing Struct",
|
|
"description": "This struct shows off generating a schema with\n a custom title and description.",
|
|
"type": "object",
|
|
"properties": {
|
|
"my_bool": {
|
|
"description": "This bool has a description, but no title.",
|
|
"type": "boolean"
|
|
},
|
|
"my_int": {
|
|
"title": "My Amazing Integer",
|
|
"type": "integer",
|
|
"format": "int32"
|
|
},
|
|
"my_nullable_enum": {
|
|
"title": "A Nullable Enum",
|
|
"description": "This enum might be set, or it might not.",
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/$defs/MyEnum"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"required": [
|
|
"my_int",
|
|
"my_bool"
|
|
],
|
|
"$defs": {
|
|
"MyEnum": {
|
|
"title": "My Amazing Enum",
|
|
"oneOf": [
|
|
{
|
|
"description": "A wrapper around a `String`",
|
|
"type": "object",
|
|
"properties": {
|
|
"StringNewType": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"StringNewType"
|
|
]
|
|
},
|
|
{
|
|
"description": "A struct-like enum variant which contains\n some floats",
|
|
"type": "object",
|
|
"properties": {
|
|
"StructVariant": {
|
|
"type": "object",
|
|
"properties": {
|
|
"floats": {
|
|
"description": "The floats themselves",
|
|
"type": "array",
|
|
"items": {
|
|
"type": "number",
|
|
"format": "float"
|
|
}
|
|
}
|
|
},
|
|
"required": [
|
|
"floats"
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"StructVariant"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|