schemars/docs/_includes/examples/schemars_attrs.schema.json
2024-08-27 16:50:47 +01:00

67 lines
1.2 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "MyStruct",
"type": "object",
"properties": {
"myBool": {
"type": "boolean"
},
"myNullableEnum": {
"anyOf": [
{
"$ref": "#/$defs/MyEnum"
},
{
"type": "null"
}
],
"default": null
},
"myNumber": {
"type": "integer",
"maximum": 10,
"minimum": 1
},
"myVecStr": {
"type": "array",
"items": {
"type": "string",
"pattern": "^x$"
}
}
},
"additionalProperties": false,
"required": [
"myNumber",
"myBool",
"myVecStr"
],
"x-customProperty": "example",
"$defs": {
"MyEnum": {
"anyOf": [
{
"type": "string",
"format": "email"
},
{
"type": "object",
"properties": {
"floats": {
"type": "array",
"items": {
"type": "number",
"format": "float"
},
"maxItems": 100,
"minItems": 1
}
},
"required": [
"floats"
]
}
]
}
}
}