Get title/description from #[doc] on enum variants

This commit is contained in:
Graham Esau 2019-12-07 23:29:37 +00:00
parent a1c3daaed8
commit d92b741b9b
5 changed files with 394 additions and 25 deletions

View file

@ -0,0 +1,39 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "This is the enum's title",
"description": "This is the enum's description.",
"anyOf": [
{
"enum": [
"UndocumentedUnit",
"DocumentedUnit"
]
},
{
"title": "Complex variant",
"description": "This is a struct-like variant.",
"type": "object",
"required": [
"Complex"
],
"properties": {
"Complex": {
"type": "object",
"required": [
"my_nullable_string"
],
"properties": {
"my_nullable_string": {
"title": "A nullable string",
"description": "This field is a nullable string.\n\nThis is the second line!\n\nAnd this is the third!",
"type": [
"string",
"null"
]
}
}
}
}
}
]
}

View file

@ -0,0 +1,35 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "This is the struct's title",
"description": "This is the struct's description.",
"type": "object",
"required": [
"my_int",
"my_undocumented_bool",
"my_unit"
],
"properties": {
"my_int": {
"title": "An integer",
"type": "integer",
"format": "int32"
},
"my_undocumented_bool": {
"type": "boolean"
},
"my_unit": {
"description": "A unit struct instance",
"allOf": [
{
"$ref": "#/definitions/MyUnitStruct"
}
]
}
},
"definitions": {
"MyUnitStruct": {
"title": "A Unit",
"type": "null"
}
}
}

View file

@ -1,43 +1,62 @@
{ {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema", "$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
"title": "RootSchema", "title": "RootSchema",
"description": "The root object of a JSON Schema document.",
"type": "object", "type": "object",
"properties": { "properties": {
"$id": { "$id": {
"description": "The `$id` keyword.\n\nSee [JSON Schema 8.2.2. The \"$id\" Keyword](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.2.2).",
"type": "string", "type": "string",
"nullable": true "nullable": true
}, },
"$ref": { "$ref": {
"description": "The `$ref` keyword.\n\nSee [JSON Schema 8.2.4.1. Direct References with \"$ref\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.2.4.1).",
"type": "string", "type": "string",
"nullable": true "nullable": true
}, },
"$schema": { "$schema": {
"description": "The `$schema` keyword.\n\nSee [JSON Schema 8.1.1. The \"$schema\" Keyword](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.1.1).",
"type": "string", "type": "string",
"nullable": true "nullable": true
}, },
"additionalItems": { "additionalItems": {
"description": "The `additionalItems` keyword.\n\nSee [JSON Schema 9.3.1.2. \"additionalItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.1.2).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"additionalProperties": { "additionalProperties": {
"description": "The `additionalProperties` keyword.\n\nSee [JSON Schema 9.3.2.3. \"additionalProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.3).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"allOf": { "allOf": {
"description": "The `allOf` keyword.\n\nSee [JSON Schema 9.2.1.1. \"allOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.1).",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/components/schemas/Schema" "$ref": "#/components/schemas/Schema"
@ -45,6 +64,7 @@
"nullable": true "nullable": true
}, },
"anyOf": { "anyOf": {
"description": "The `anyOf` keyword.\n\nSee [JSON Schema 9.2.1.2. \"anyOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.2).",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/components/schemas/Schema" "$ref": "#/components/schemas/Schema"
@ -52,77 +72,108 @@
"nullable": true "nullable": true
}, },
"const": { "const": {
"description": "The `const` keyword.\n\nSee [JSON Schema Validation 6.1.3. \"const\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.1.3)",
"nullable": true "nullable": true
}, },
"contains": { "contains": {
"description": "The `contains` keyword.\n\nSee [JSON Schema 9.3.1.4. \"contains\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.1.4).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"default": { "default": {
"description": "The `default` keyword.\n\nSee [JSON Schema Validation 9.2. \"default\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.2).",
"nullable": true "nullable": true
}, },
"definitions": { "definitions": {
"description": "The `$defs` keyword.\n\nThis is currently serialized as `definitions` for backwards compatibility.\n\nSee [JSON Schema 8.2.5. Schema Re-Use With \"$defs\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.2.5).",
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"$ref": "#/components/schemas/Schema" "$ref": "#/components/schemas/Schema"
} }
}, },
"deprecated": { "deprecated": {
"description": "The `deprecated` keyword.\n\nSee [JSON Schema Validation 9.3. \"deprecated\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.3).",
"type": "boolean" "type": "boolean"
}, },
"description": { "description": {
"description": "The `description` keyword.\n\nSee [JSON Schema Validation 9.1. \"title\" and \"description\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.1).",
"type": "string", "type": "string",
"nullable": true "nullable": true
}, },
"else": { "else": {
"description": "The `else` keyword.\n\nSee [JSON Schema 9.2.2.3. \"else\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.2.3).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"enum": { "enum": {
"description": "The `enum` keyword.\n\nSee [JSON Schema Validation 6.1.2. \"enum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.1.2)",
"type": "array", "type": "array",
"items": {}, "items": {},
"nullable": true "nullable": true
}, },
"exclusiveMaximum": { "exclusiveMaximum": {
"description": "The `exclusiveMaximum` keyword.\n\nSee [JSON Schema Validation 6.2.3. \"exclusiveMaximum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.3).",
"type": "number", "type": "number",
"format": "double", "format": "double",
"nullable": true "nullable": true
}, },
"exclusiveMinimum": { "exclusiveMinimum": {
"description": "The `exclusiveMinimum` keyword.\n\nSee [JSON Schema Validation 6.2.5. \"exclusiveMinimum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.5).",
"type": "number", "type": "number",
"format": "double", "format": "double",
"nullable": true "nullable": true
}, },
"format": { "format": {
"description": "The `format` keyword.\n\nSee [JSON Schema Validation 7. A Vocabulary for Semantic Content With \"format\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-7).",
"type": "string", "type": "string",
"nullable": true "nullable": true
}, },
"if": { "if": {
"description": "The `if` keyword.\n\nSee [JSON Schema 9.2.2.1. \"if\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.2.1).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"items": { "items": {
"description": "The `items` keyword.\n\nSee [JSON Schema 9.3.1.1. \"items\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.1.1).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/components/schemas/Schema" "$ref": "#/components/schemas/Schema"
@ -137,68 +188,85 @@
"nullable": true "nullable": true
}, },
"maxItems": { "maxItems": {
"description": "The `maxItems` keyword.\n\nSee [JSON Schema Validation 6.4.1. \"maxItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.4.1).",
"type": "integer", "type": "integer",
"format": "uint32", "format": "uint32",
"minimum": 0.0, "minimum": 0.0,
"nullable": true "nullable": true
}, },
"maxLength": { "maxLength": {
"description": "The `maxLength` keyword.\n\nSee [JSON Schema Validation 6.3.1. \"maxLength\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.3.1).",
"type": "integer", "type": "integer",
"format": "uint32", "format": "uint32",
"minimum": 0.0, "minimum": 0.0,
"nullable": true "nullable": true
}, },
"maxProperties": { "maxProperties": {
"description": "The `maxProperties` keyword.\n\nSee [JSON Schema Validation 6.5.1. \"maxProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.5.1).",
"type": "integer", "type": "integer",
"format": "uint32", "format": "uint32",
"minimum": 0.0, "minimum": 0.0,
"nullable": true "nullable": true
}, },
"maximum": { "maximum": {
"description": "The `maximum` keyword.\n\nSee [JSON Schema Validation 6.2.2. \"maximum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.2).",
"type": "number", "type": "number",
"format": "double", "format": "double",
"nullable": true "nullable": true
}, },
"minItems": { "minItems": {
"description": "The `minItems` keyword.\n\nSee [JSON Schema Validation 6.4.2. \"minItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.4.2).",
"type": "integer", "type": "integer",
"format": "uint32", "format": "uint32",
"minimum": 0.0, "minimum": 0.0,
"nullable": true "nullable": true
}, },
"minLength": { "minLength": {
"description": "The `minLength` keyword.\n\nSee [JSON Schema Validation 6.3.2. \"minLength\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.3.2).",
"type": "integer", "type": "integer",
"format": "uint32", "format": "uint32",
"minimum": 0.0, "minimum": 0.0,
"nullable": true "nullable": true
}, },
"minProperties": { "minProperties": {
"description": "The `minProperties` keyword.\n\nSee [JSON Schema Validation 6.5.2. \"minProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.5.2).",
"type": "integer", "type": "integer",
"format": "uint32", "format": "uint32",
"minimum": 0.0, "minimum": 0.0,
"nullable": true "nullable": true
}, },
"minimum": { "minimum": {
"description": "The `minimum` keyword.\n\nSee [JSON Schema Validation 6.2.4. \"minimum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.4).",
"type": "number", "type": "number",
"format": "double", "format": "double",
"nullable": true "nullable": true
}, },
"multipleOf": { "multipleOf": {
"description": "The `multipleOf` keyword.\n\nSee [JSON Schema Validation 6.2.1. \"multipleOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.1).",
"type": "number", "type": "number",
"format": "double", "format": "double",
"nullable": true "nullable": true
}, },
"not": { "not": {
"description": "The `not` keyword.\n\nSee [JSON Schema 9.2.1.4. \"not\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.4).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"oneOf": { "oneOf": {
"description": "The `oneOf` keyword.\n\nSee [JSON Schema 9.2.1.3. \"oneOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.3).",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/components/schemas/Schema" "$ref": "#/components/schemas/Schema"
@ -206,57 +274,78 @@
"nullable": true "nullable": true
}, },
"pattern": { "pattern": {
"description": "The `pattern` keyword.\n\nSee [JSON Schema Validation 6.3.3. \"pattern\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.3.3).",
"type": "string", "type": "string",
"nullable": true "nullable": true
}, },
"patternProperties": { "patternProperties": {
"description": "The `patternProperties` keyword.\n\nSee [JSON Schema 9.3.2.2. \"patternProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.2).",
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"$ref": "#/components/schemas/Schema" "$ref": "#/components/schemas/Schema"
} }
}, },
"properties": { "properties": {
"description": "The `properties` keyword.\n\nSee [JSON Schema 9.3.2.1. \"properties\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.1).",
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"$ref": "#/components/schemas/Schema" "$ref": "#/components/schemas/Schema"
} }
}, },
"propertyNames": { "propertyNames": {
"description": "The `propertyNames` keyword.\n\nSee [JSON Schema 9.3.2.5. \"propertyNames\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.5).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"readOnly": { "readOnly": {
"description": "The `readOnly` keyword.\n\nSee [JSON Schema Validation 9.4. \"readOnly\" and \"writeOnly\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.4).",
"type": "boolean" "type": "boolean"
}, },
"required": { "required": {
"description": "The `required` keyword.\n\nSee [JSON Schema Validation 6.5.3. \"required\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.5.3).",
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
} }
}, },
"then": { "then": {
"description": "The `then` keyword.\n\nSee [JSON Schema 9.2.2.2. \"then\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.2.2).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"title": { "title": {
"description": "The `title` keyword.\n\nSee [JSON Schema Validation 9.1. \"title\" and \"description\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.1).",
"type": "string", "type": "string",
"nullable": true "nullable": true
}, },
"type": { "type": {
"description": "The `type` keyword.\n\nSee [JSON Schema Validation 6.1.1. \"type\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.1.1) and [JSON Schema 4.2.1. Instance Data Model](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-4.2.1).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/components/schemas/InstanceType" "$ref": "#/components/schemas/InstanceType"
@ -271,16 +360,19 @@
"nullable": true "nullable": true
}, },
"uniqueItems": { "uniqueItems": {
"description": "The `uniqueItems` keyword.\n\nSee [JSON Schema Validation 6.4.3. \"uniqueItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.4.3).",
"type": "boolean", "type": "boolean",
"nullable": true "nullable": true
}, },
"writeOnly": { "writeOnly": {
"description": "The `writeOnly` keyword.\n\nSee [JSON Schema Validation 9.4. \"readOnly\" and \"writeOnly\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.4).",
"type": "boolean" "type": "boolean"
} }
}, },
"additionalProperties": true, "additionalProperties": true,
"definitions": { "definitions": {
"InstanceType": { "InstanceType": {
"description": "The possible types of values in JSON Schema documents.\n\nSee [JSON Schema 4.2.1. Instance Data Model](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-4.2.1).",
"enum": [ "enum": [
"null", "null",
"boolean", "boolean",
@ -292,49 +384,74 @@
] ]
}, },
"Schema": { "Schema": {
"description": "A JSON Schema.",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
] ]
}, },
"SchemaObject": { "SchemaObject": {
"description": "A JSON Schema object.",
"type": "object", "type": "object",
"properties": { "properties": {
"$id": { "$id": {
"description": "The `$id` keyword.\n\nSee [JSON Schema 8.2.2. The \"$id\" Keyword](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.2.2).",
"type": "string", "type": "string",
"nullable": true "nullable": true
}, },
"$ref": { "$ref": {
"description": "The `$ref` keyword.\n\nSee [JSON Schema 8.2.4.1. Direct References with \"$ref\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.2.4.1).",
"type": "string", "type": "string",
"nullable": true "nullable": true
}, },
"additionalItems": { "additionalItems": {
"description": "The `additionalItems` keyword.\n\nSee [JSON Schema 9.3.1.2. \"additionalItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.1.2).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"additionalProperties": { "additionalProperties": {
"description": "The `additionalProperties` keyword.\n\nSee [JSON Schema 9.3.2.3. \"additionalProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.3).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"allOf": { "allOf": {
"description": "The `allOf` keyword.\n\nSee [JSON Schema 9.2.1.1. \"allOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.1).",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/components/schemas/Schema" "$ref": "#/components/schemas/Schema"
@ -342,6 +459,7 @@
"nullable": true "nullable": true
}, },
"anyOf": { "anyOf": {
"description": "The `anyOf` keyword.\n\nSee [JSON Schema 9.2.1.2. \"anyOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.2).",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/components/schemas/Schema" "$ref": "#/components/schemas/Schema"
@ -349,71 +467,101 @@
"nullable": true "nullable": true
}, },
"const": { "const": {
"description": "The `const` keyword.\n\nSee [JSON Schema Validation 6.1.3. \"const\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.1.3)",
"nullable": true "nullable": true
}, },
"contains": { "contains": {
"description": "The `contains` keyword.\n\nSee [JSON Schema 9.3.1.4. \"contains\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.1.4).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"default": { "default": {
"description": "The `default` keyword.\n\nSee [JSON Schema Validation 9.2. \"default\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.2).",
"nullable": true "nullable": true
}, },
"deprecated": { "deprecated": {
"description": "The `deprecated` keyword.\n\nSee [JSON Schema Validation 9.3. \"deprecated\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.3).",
"type": "boolean" "type": "boolean"
}, },
"description": { "description": {
"description": "The `description` keyword.\n\nSee [JSON Schema Validation 9.1. \"title\" and \"description\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.1).",
"type": "string", "type": "string",
"nullable": true "nullable": true
}, },
"else": { "else": {
"description": "The `else` keyword.\n\nSee [JSON Schema 9.2.2.3. \"else\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.2.3).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"enum": { "enum": {
"description": "The `enum` keyword.\n\nSee [JSON Schema Validation 6.1.2. \"enum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.1.2)",
"type": "array", "type": "array",
"items": {}, "items": {},
"nullable": true "nullable": true
}, },
"exclusiveMaximum": { "exclusiveMaximum": {
"description": "The `exclusiveMaximum` keyword.\n\nSee [JSON Schema Validation 6.2.3. \"exclusiveMaximum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.3).",
"type": "number", "type": "number",
"format": "double", "format": "double",
"nullable": true "nullable": true
}, },
"exclusiveMinimum": { "exclusiveMinimum": {
"description": "The `exclusiveMinimum` keyword.\n\nSee [JSON Schema Validation 6.2.5. \"exclusiveMinimum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.5).",
"type": "number", "type": "number",
"format": "double", "format": "double",
"nullable": true "nullable": true
}, },
"format": { "format": {
"description": "The `format` keyword.\n\nSee [JSON Schema Validation 7. A Vocabulary for Semantic Content With \"format\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-7).",
"type": "string", "type": "string",
"nullable": true "nullable": true
}, },
"if": { "if": {
"description": "The `if` keyword.\n\nSee [JSON Schema 9.2.2.1. \"if\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.2.1).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"items": { "items": {
"description": "The `items` keyword.\n\nSee [JSON Schema 9.3.1.1. \"items\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.1.1).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/components/schemas/Schema" "$ref": "#/components/schemas/Schema"
@ -428,68 +576,85 @@
"nullable": true "nullable": true
}, },
"maxItems": { "maxItems": {
"description": "The `maxItems` keyword.\n\nSee [JSON Schema Validation 6.4.1. \"maxItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.4.1).",
"type": "integer", "type": "integer",
"format": "uint32", "format": "uint32",
"minimum": 0.0, "minimum": 0.0,
"nullable": true "nullable": true
}, },
"maxLength": { "maxLength": {
"description": "The `maxLength` keyword.\n\nSee [JSON Schema Validation 6.3.1. \"maxLength\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.3.1).",
"type": "integer", "type": "integer",
"format": "uint32", "format": "uint32",
"minimum": 0.0, "minimum": 0.0,
"nullable": true "nullable": true
}, },
"maxProperties": { "maxProperties": {
"description": "The `maxProperties` keyword.\n\nSee [JSON Schema Validation 6.5.1. \"maxProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.5.1).",
"type": "integer", "type": "integer",
"format": "uint32", "format": "uint32",
"minimum": 0.0, "minimum": 0.0,
"nullable": true "nullable": true
}, },
"maximum": { "maximum": {
"description": "The `maximum` keyword.\n\nSee [JSON Schema Validation 6.2.2. \"maximum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.2).",
"type": "number", "type": "number",
"format": "double", "format": "double",
"nullable": true "nullable": true
}, },
"minItems": { "minItems": {
"description": "The `minItems` keyword.\n\nSee [JSON Schema Validation 6.4.2. \"minItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.4.2).",
"type": "integer", "type": "integer",
"format": "uint32", "format": "uint32",
"minimum": 0.0, "minimum": 0.0,
"nullable": true "nullable": true
}, },
"minLength": { "minLength": {
"description": "The `minLength` keyword.\n\nSee [JSON Schema Validation 6.3.2. \"minLength\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.3.2).",
"type": "integer", "type": "integer",
"format": "uint32", "format": "uint32",
"minimum": 0.0, "minimum": 0.0,
"nullable": true "nullable": true
}, },
"minProperties": { "minProperties": {
"description": "The `minProperties` keyword.\n\nSee [JSON Schema Validation 6.5.2. \"minProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.5.2).",
"type": "integer", "type": "integer",
"format": "uint32", "format": "uint32",
"minimum": 0.0, "minimum": 0.0,
"nullable": true "nullable": true
}, },
"minimum": { "minimum": {
"description": "The `minimum` keyword.\n\nSee [JSON Schema Validation 6.2.4. \"minimum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.4).",
"type": "number", "type": "number",
"format": "double", "format": "double",
"nullable": true "nullable": true
}, },
"multipleOf": { "multipleOf": {
"description": "The `multipleOf` keyword.\n\nSee [JSON Schema Validation 6.2.1. \"multipleOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.1).",
"type": "number", "type": "number",
"format": "double", "format": "double",
"nullable": true "nullable": true
}, },
"not": { "not": {
"description": "The `not` keyword.\n\nSee [JSON Schema 9.2.1.4. \"not\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.4).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"oneOf": { "oneOf": {
"description": "The `oneOf` keyword.\n\nSee [JSON Schema 9.2.1.3. \"oneOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.3).",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/components/schemas/Schema" "$ref": "#/components/schemas/Schema"
@ -497,57 +662,78 @@
"nullable": true "nullable": true
}, },
"pattern": { "pattern": {
"description": "The `pattern` keyword.\n\nSee [JSON Schema Validation 6.3.3. \"pattern\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.3.3).",
"type": "string", "type": "string",
"nullable": true "nullable": true
}, },
"patternProperties": { "patternProperties": {
"description": "The `patternProperties` keyword.\n\nSee [JSON Schema 9.3.2.2. \"patternProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.2).",
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"$ref": "#/components/schemas/Schema" "$ref": "#/components/schemas/Schema"
} }
}, },
"properties": { "properties": {
"description": "The `properties` keyword.\n\nSee [JSON Schema 9.3.2.1. \"properties\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.1).",
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"$ref": "#/components/schemas/Schema" "$ref": "#/components/schemas/Schema"
} }
}, },
"propertyNames": { "propertyNames": {
"description": "The `propertyNames` keyword.\n\nSee [JSON Schema 9.3.2.5. \"propertyNames\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.5).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"readOnly": { "readOnly": {
"description": "The `readOnly` keyword.\n\nSee [JSON Schema Validation 9.4. \"readOnly\" and \"writeOnly\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.4).",
"type": "boolean" "type": "boolean"
}, },
"required": { "required": {
"description": "The `required` keyword.\n\nSee [JSON Schema Validation 6.5.3. \"required\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.5.3).",
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
} }
}, },
"then": { "then": {
"description": "The `then` keyword.\n\nSee [JSON Schema 9.2.2.2. \"then\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.2.2).",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/components/schemas/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/components/schemas/SchemaObject"
}
]
} }
], ],
"nullable": true "nullable": true
}, },
"title": { "title": {
"description": "The `title` keyword.\n\nSee [JSON Schema Validation 9.1. \"title\" and \"description\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.1).",
"type": "string", "type": "string",
"nullable": true "nullable": true
}, },
"type": { "type": {
"description": "The `type` keyword.\n\nSee [JSON Schema Validation 6.1.1. \"type\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.1.1) and [JSON Schema 4.2.1. Instance Data Model](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-4.2.1).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/components/schemas/InstanceType" "$ref": "#/components/schemas/InstanceType"
@ -562,10 +748,12 @@
"nullable": true "nullable": true
}, },
"uniqueItems": { "uniqueItems": {
"description": "The `uniqueItems` keyword.\n\nSee [JSON Schema Validation 6.4.3. \"uniqueItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.4.3).",
"type": "boolean", "type": "boolean",
"nullable": true "nullable": true
}, },
"writeOnly": { "writeOnly": {
"description": "The `writeOnly` keyword.\n\nSee [JSON Schema Validation 9.4. \"readOnly\" and \"writeOnly\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.4).",
"type": "boolean" "type": "boolean"
} }
}, },

View file

@ -1,27 +1,32 @@
{ {
"$schema": "http://json-schema.org/draft-07/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"title": "RootSchema", "title": "RootSchema",
"description": "The root object of a JSON Schema document.",
"type": "object", "type": "object",
"properties": { "properties": {
"$id": { "$id": {
"description": "The `$id` keyword.\n\nSee [JSON Schema 8.2.2. The \"$id\" Keyword](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.2.2).",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"$ref": { "$ref": {
"description": "The `$ref` keyword.\n\nSee [JSON Schema 8.2.4.1. Direct References with \"$ref\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.2.4.1).",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"$schema": { "$schema": {
"description": "The `$schema` keyword.\n\nSee [JSON Schema 8.1.1. The \"$schema\" Keyword](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.1.1).",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"additionalItems": { "additionalItems": {
"description": "The `additionalItems` keyword.\n\nSee [JSON Schema 9.3.1.2. \"additionalItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.1.2).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -32,6 +37,7 @@
] ]
}, },
"additionalProperties": { "additionalProperties": {
"description": "The `additionalProperties` keyword.\n\nSee [JSON Schema 9.3.2.3. \"additionalProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.3).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -42,6 +48,7 @@
] ]
}, },
"allOf": { "allOf": {
"description": "The `allOf` keyword.\n\nSee [JSON Schema 9.2.1.1. \"allOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.1).",
"type": [ "type": [
"array", "array",
"null" "null"
@ -51,6 +58,7 @@
} }
}, },
"anyOf": { "anyOf": {
"description": "The `anyOf` keyword.\n\nSee [JSON Schema 9.2.1.2. \"anyOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.2).",
"type": [ "type": [
"array", "array",
"null" "null"
@ -59,8 +67,11 @@
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
} }
}, },
"const": true, "const": {
"description": "The `const` keyword.\n\nSee [JSON Schema Validation 6.1.3. \"const\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.1.3)"
},
"contains": { "contains": {
"description": "The `contains` keyword.\n\nSee [JSON Schema 9.3.1.4. \"contains\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.1.4).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -70,23 +81,29 @@
} }
] ]
}, },
"default": true, "default": {
"description": "The `default` keyword.\n\nSee [JSON Schema Validation 9.2. \"default\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.2)."
},
"definitions": { "definitions": {
"description": "The `$defs` keyword.\n\nThis is currently serialized as `definitions` for backwards compatibility.\n\nSee [JSON Schema 8.2.5. Schema Re-Use With \"$defs\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.2.5).",
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
} }
}, },
"deprecated": { "deprecated": {
"description": "The `deprecated` keyword.\n\nSee [JSON Schema Validation 9.3. \"deprecated\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.3).",
"type": "boolean" "type": "boolean"
}, },
"description": { "description": {
"description": "The `description` keyword.\n\nSee [JSON Schema Validation 9.1. \"title\" and \"description\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.1).",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"else": { "else": {
"description": "The `else` keyword.\n\nSee [JSON Schema 9.2.2.3. \"else\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.2.3).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -97,6 +114,7 @@
] ]
}, },
"enum": { "enum": {
"description": "The `enum` keyword.\n\nSee [JSON Schema Validation 6.1.2. \"enum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.1.2)",
"type": [ "type": [
"array", "array",
"null" "null"
@ -104,6 +122,7 @@
"items": true "items": true
}, },
"exclusiveMaximum": { "exclusiveMaximum": {
"description": "The `exclusiveMaximum` keyword.\n\nSee [JSON Schema Validation 6.2.3. \"exclusiveMaximum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.3).",
"type": [ "type": [
"number", "number",
"null" "null"
@ -111,6 +130,7 @@
"format": "double" "format": "double"
}, },
"exclusiveMinimum": { "exclusiveMinimum": {
"description": "The `exclusiveMinimum` keyword.\n\nSee [JSON Schema Validation 6.2.5. \"exclusiveMinimum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.5).",
"type": [ "type": [
"number", "number",
"null" "null"
@ -118,12 +138,14 @@
"format": "double" "format": "double"
}, },
"format": { "format": {
"description": "The `format` keyword.\n\nSee [JSON Schema Validation 7. A Vocabulary for Semantic Content With \"format\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-7).",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"if": { "if": {
"description": "The `if` keyword.\n\nSee [JSON Schema 9.2.2.1. \"if\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.2.1).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -134,6 +156,7 @@
] ]
}, },
"items": { "items": {
"description": "The `items` keyword.\n\nSee [JSON Schema 9.3.1.1. \"items\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.1.1).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/SingleOrVec_for_Schema" "$ref": "#/definitions/SingleOrVec_for_Schema"
@ -144,6 +167,7 @@
] ]
}, },
"maxItems": { "maxItems": {
"description": "The `maxItems` keyword.\n\nSee [JSON Schema Validation 6.4.1. \"maxItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.4.1).",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -152,6 +176,7 @@
"minimum": 0.0 "minimum": 0.0
}, },
"maxLength": { "maxLength": {
"description": "The `maxLength` keyword.\n\nSee [JSON Schema Validation 6.3.1. \"maxLength\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.3.1).",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -160,6 +185,7 @@
"minimum": 0.0 "minimum": 0.0
}, },
"maxProperties": { "maxProperties": {
"description": "The `maxProperties` keyword.\n\nSee [JSON Schema Validation 6.5.1. \"maxProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.5.1).",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -168,6 +194,7 @@
"minimum": 0.0 "minimum": 0.0
}, },
"maximum": { "maximum": {
"description": "The `maximum` keyword.\n\nSee [JSON Schema Validation 6.2.2. \"maximum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.2).",
"type": [ "type": [
"number", "number",
"null" "null"
@ -175,6 +202,7 @@
"format": "double" "format": "double"
}, },
"minItems": { "minItems": {
"description": "The `minItems` keyword.\n\nSee [JSON Schema Validation 6.4.2. \"minItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.4.2).",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -183,6 +211,7 @@
"minimum": 0.0 "minimum": 0.0
}, },
"minLength": { "minLength": {
"description": "The `minLength` keyword.\n\nSee [JSON Schema Validation 6.3.2. \"minLength\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.3.2).",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -191,6 +220,7 @@
"minimum": 0.0 "minimum": 0.0
}, },
"minProperties": { "minProperties": {
"description": "The `minProperties` keyword.\n\nSee [JSON Schema Validation 6.5.2. \"minProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.5.2).",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -199,6 +229,7 @@
"minimum": 0.0 "minimum": 0.0
}, },
"minimum": { "minimum": {
"description": "The `minimum` keyword.\n\nSee [JSON Schema Validation 6.2.4. \"minimum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.4).",
"type": [ "type": [
"number", "number",
"null" "null"
@ -206,6 +237,7 @@
"format": "double" "format": "double"
}, },
"multipleOf": { "multipleOf": {
"description": "The `multipleOf` keyword.\n\nSee [JSON Schema Validation 6.2.1. \"multipleOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.1).",
"type": [ "type": [
"number", "number",
"null" "null"
@ -213,6 +245,7 @@
"format": "double" "format": "double"
}, },
"not": { "not": {
"description": "The `not` keyword.\n\nSee [JSON Schema 9.2.1.4. \"not\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.4).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -223,6 +256,7 @@
] ]
}, },
"oneOf": { "oneOf": {
"description": "The `oneOf` keyword.\n\nSee [JSON Schema 9.2.1.3. \"oneOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.3).",
"type": [ "type": [
"array", "array",
"null" "null"
@ -232,24 +266,28 @@
} }
}, },
"pattern": { "pattern": {
"description": "The `pattern` keyword.\n\nSee [JSON Schema Validation 6.3.3. \"pattern\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.3.3).",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"patternProperties": { "patternProperties": {
"description": "The `patternProperties` keyword.\n\nSee [JSON Schema 9.3.2.2. \"patternProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.2).",
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
} }
}, },
"properties": { "properties": {
"description": "The `properties` keyword.\n\nSee [JSON Schema 9.3.2.1. \"properties\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.1).",
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
} }
}, },
"propertyNames": { "propertyNames": {
"description": "The `propertyNames` keyword.\n\nSee [JSON Schema 9.3.2.5. \"propertyNames\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.5).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -260,15 +298,18 @@
] ]
}, },
"readOnly": { "readOnly": {
"description": "The `readOnly` keyword.\n\nSee [JSON Schema Validation 9.4. \"readOnly\" and \"writeOnly\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.4).",
"type": "boolean" "type": "boolean"
}, },
"required": { "required": {
"description": "The `required` keyword.\n\nSee [JSON Schema Validation 6.5.3. \"required\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.5.3).",
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
} }
}, },
"then": { "then": {
"description": "The `then` keyword.\n\nSee [JSON Schema 9.2.2.2. \"then\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.2.2).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -279,12 +320,14 @@
] ]
}, },
"title": { "title": {
"description": "The `title` keyword.\n\nSee [JSON Schema Validation 9.1. \"title\" and \"description\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.1).",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"type": { "type": {
"description": "The `type` keyword.\n\nSee [JSON Schema Validation 6.1.1. \"type\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.1.1) and [JSON Schema 4.2.1. Instance Data Model](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-4.2.1).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/SingleOrVec_for_InstanceType" "$ref": "#/definitions/SingleOrVec_for_InstanceType"
@ -295,18 +338,21 @@
] ]
}, },
"uniqueItems": { "uniqueItems": {
"description": "The `uniqueItems` keyword.\n\nSee [JSON Schema Validation 6.4.3. \"uniqueItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.4.3).",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"writeOnly": { "writeOnly": {
"description": "The `writeOnly` keyword.\n\nSee [JSON Schema Validation 9.4. \"readOnly\" and \"writeOnly\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.4).",
"type": "boolean" "type": "boolean"
} }
}, },
"additionalProperties": true, "additionalProperties": true,
"definitions": { "definitions": {
"InstanceType": { "InstanceType": {
"description": "The possible types of values in JSON Schema documents.\n\nSee [JSON Schema 4.2.1. Instance Data Model](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-4.2.1).",
"enum": [ "enum": [
"null", "null",
"boolean", "boolean",
@ -318,31 +364,42 @@
] ]
}, },
"Schema": { "Schema": {
"description": "A JSON Schema.",
"anyOf": [ "anyOf": [
{ {
"description": "A trivial boolean JSON Schema.\n\nThe schema `true` matches everything (always passes validation), whereas the schema `false` matches nothing (always fails validation).",
"type": "boolean" "type": "boolean"
}, },
{ {
"$ref": "#/definitions/SchemaObject" "description": "A JSON Schema object.",
"allOf": [
{
"$ref": "#/definitions/SchemaObject"
}
]
} }
] ]
}, },
"SchemaObject": { "SchemaObject": {
"description": "A JSON Schema object.",
"type": "object", "type": "object",
"properties": { "properties": {
"$id": { "$id": {
"description": "The `$id` keyword.\n\nSee [JSON Schema 8.2.2. The \"$id\" Keyword](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.2.2).",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"$ref": { "$ref": {
"description": "The `$ref` keyword.\n\nSee [JSON Schema 8.2.4.1. Direct References with \"$ref\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-8.2.4.1).",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"additionalItems": { "additionalItems": {
"description": "The `additionalItems` keyword.\n\nSee [JSON Schema 9.3.1.2. \"additionalItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.1.2).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -353,6 +410,7 @@
] ]
}, },
"additionalProperties": { "additionalProperties": {
"description": "The `additionalProperties` keyword.\n\nSee [JSON Schema 9.3.2.3. \"additionalProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.3).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -363,6 +421,7 @@
] ]
}, },
"allOf": { "allOf": {
"description": "The `allOf` keyword.\n\nSee [JSON Schema 9.2.1.1. \"allOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.1).",
"type": [ "type": [
"array", "array",
"null" "null"
@ -372,6 +431,7 @@
} }
}, },
"anyOf": { "anyOf": {
"description": "The `anyOf` keyword.\n\nSee [JSON Schema 9.2.1.2. \"anyOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.2).",
"type": [ "type": [
"array", "array",
"null" "null"
@ -380,8 +440,11 @@
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
} }
}, },
"const": true, "const": {
"description": "The `const` keyword.\n\nSee [JSON Schema Validation 6.1.3. \"const\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.1.3)"
},
"contains": { "contains": {
"description": "The `contains` keyword.\n\nSee [JSON Schema 9.3.1.4. \"contains\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.1.4).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -391,17 +454,22 @@
} }
] ]
}, },
"default": true, "default": {
"description": "The `default` keyword.\n\nSee [JSON Schema Validation 9.2. \"default\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.2)."
},
"deprecated": { "deprecated": {
"description": "The `deprecated` keyword.\n\nSee [JSON Schema Validation 9.3. \"deprecated\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.3).",
"type": "boolean" "type": "boolean"
}, },
"description": { "description": {
"description": "The `description` keyword.\n\nSee [JSON Schema Validation 9.1. \"title\" and \"description\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.1).",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"else": { "else": {
"description": "The `else` keyword.\n\nSee [JSON Schema 9.2.2.3. \"else\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.2.3).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -412,6 +480,7 @@
] ]
}, },
"enum": { "enum": {
"description": "The `enum` keyword.\n\nSee [JSON Schema Validation 6.1.2. \"enum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.1.2)",
"type": [ "type": [
"array", "array",
"null" "null"
@ -419,6 +488,7 @@
"items": true "items": true
}, },
"exclusiveMaximum": { "exclusiveMaximum": {
"description": "The `exclusiveMaximum` keyword.\n\nSee [JSON Schema Validation 6.2.3. \"exclusiveMaximum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.3).",
"type": [ "type": [
"number", "number",
"null" "null"
@ -426,6 +496,7 @@
"format": "double" "format": "double"
}, },
"exclusiveMinimum": { "exclusiveMinimum": {
"description": "The `exclusiveMinimum` keyword.\n\nSee [JSON Schema Validation 6.2.5. \"exclusiveMinimum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.5).",
"type": [ "type": [
"number", "number",
"null" "null"
@ -433,12 +504,14 @@
"format": "double" "format": "double"
}, },
"format": { "format": {
"description": "The `format` keyword.\n\nSee [JSON Schema Validation 7. A Vocabulary for Semantic Content With \"format\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-7).",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"if": { "if": {
"description": "The `if` keyword.\n\nSee [JSON Schema 9.2.2.1. \"if\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.2.1).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -449,6 +522,7 @@
] ]
}, },
"items": { "items": {
"description": "The `items` keyword.\n\nSee [JSON Schema 9.3.1.1. \"items\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.1.1).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/SingleOrVec_for_Schema" "$ref": "#/definitions/SingleOrVec_for_Schema"
@ -459,6 +533,7 @@
] ]
}, },
"maxItems": { "maxItems": {
"description": "The `maxItems` keyword.\n\nSee [JSON Schema Validation 6.4.1. \"maxItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.4.1).",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -467,6 +542,7 @@
"minimum": 0.0 "minimum": 0.0
}, },
"maxLength": { "maxLength": {
"description": "The `maxLength` keyword.\n\nSee [JSON Schema Validation 6.3.1. \"maxLength\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.3.1).",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -475,6 +551,7 @@
"minimum": 0.0 "minimum": 0.0
}, },
"maxProperties": { "maxProperties": {
"description": "The `maxProperties` keyword.\n\nSee [JSON Schema Validation 6.5.1. \"maxProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.5.1).",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -483,6 +560,7 @@
"minimum": 0.0 "minimum": 0.0
}, },
"maximum": { "maximum": {
"description": "The `maximum` keyword.\n\nSee [JSON Schema Validation 6.2.2. \"maximum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.2).",
"type": [ "type": [
"number", "number",
"null" "null"
@ -490,6 +568,7 @@
"format": "double" "format": "double"
}, },
"minItems": { "minItems": {
"description": "The `minItems` keyword.\n\nSee [JSON Schema Validation 6.4.2. \"minItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.4.2).",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -498,6 +577,7 @@
"minimum": 0.0 "minimum": 0.0
}, },
"minLength": { "minLength": {
"description": "The `minLength` keyword.\n\nSee [JSON Schema Validation 6.3.2. \"minLength\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.3.2).",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -506,6 +586,7 @@
"minimum": 0.0 "minimum": 0.0
}, },
"minProperties": { "minProperties": {
"description": "The `minProperties` keyword.\n\nSee [JSON Schema Validation 6.5.2. \"minProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.5.2).",
"type": [ "type": [
"integer", "integer",
"null" "null"
@ -514,6 +595,7 @@
"minimum": 0.0 "minimum": 0.0
}, },
"minimum": { "minimum": {
"description": "The `minimum` keyword.\n\nSee [JSON Schema Validation 6.2.4. \"minimum\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.4).",
"type": [ "type": [
"number", "number",
"null" "null"
@ -521,6 +603,7 @@
"format": "double" "format": "double"
}, },
"multipleOf": { "multipleOf": {
"description": "The `multipleOf` keyword.\n\nSee [JSON Schema Validation 6.2.1. \"multipleOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.2.1).",
"type": [ "type": [
"number", "number",
"null" "null"
@ -528,6 +611,7 @@
"format": "double" "format": "double"
}, },
"not": { "not": {
"description": "The `not` keyword.\n\nSee [JSON Schema 9.2.1.4. \"not\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.4).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -538,6 +622,7 @@
] ]
}, },
"oneOf": { "oneOf": {
"description": "The `oneOf` keyword.\n\nSee [JSON Schema 9.2.1.3. \"oneOf\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.1.3).",
"type": [ "type": [
"array", "array",
"null" "null"
@ -547,24 +632,28 @@
} }
}, },
"pattern": { "pattern": {
"description": "The `pattern` keyword.\n\nSee [JSON Schema Validation 6.3.3. \"pattern\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.3.3).",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"patternProperties": { "patternProperties": {
"description": "The `patternProperties` keyword.\n\nSee [JSON Schema 9.3.2.2. \"patternProperties\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.2).",
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
} }
}, },
"properties": { "properties": {
"description": "The `properties` keyword.\n\nSee [JSON Schema 9.3.2.1. \"properties\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.1).",
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
} }
}, },
"propertyNames": { "propertyNames": {
"description": "The `propertyNames` keyword.\n\nSee [JSON Schema 9.3.2.5. \"propertyNames\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.3.2.5).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -575,15 +664,18 @@
] ]
}, },
"readOnly": { "readOnly": {
"description": "The `readOnly` keyword.\n\nSee [JSON Schema Validation 9.4. \"readOnly\" and \"writeOnly\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.4).",
"type": "boolean" "type": "boolean"
}, },
"required": { "required": {
"description": "The `required` keyword.\n\nSee [JSON Schema Validation 6.5.3. \"required\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.5.3).",
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
} }
}, },
"then": { "then": {
"description": "The `then` keyword.\n\nSee [JSON Schema 9.2.2.2. \"then\"](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-9.2.2.2).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"
@ -594,12 +686,14 @@
] ]
}, },
"title": { "title": {
"description": "The `title` keyword.\n\nSee [JSON Schema Validation 9.1. \"title\" and \"description\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.1).",
"type": [ "type": [
"string", "string",
"null" "null"
] ]
}, },
"type": { "type": {
"description": "The `type` keyword.\n\nSee [JSON Schema Validation 6.1.1. \"type\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.1.1) and [JSON Schema 4.2.1. Instance Data Model](https://tools.ietf.org/html/draft-handrews-json-schema-02#section-4.2.1).",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/SingleOrVec_for_InstanceType" "$ref": "#/definitions/SingleOrVec_for_InstanceType"
@ -610,18 +704,21 @@
] ]
}, },
"uniqueItems": { "uniqueItems": {
"description": "The `uniqueItems` keyword.\n\nSee [JSON Schema Validation 6.4.3. \"uniqueItems\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-6.4.3).",
"type": [ "type": [
"boolean", "boolean",
"null" "null"
] ]
}, },
"writeOnly": { "writeOnly": {
"description": "The `writeOnly` keyword.\n\nSee [JSON Schema Validation 9.4. \"readOnly\" and \"writeOnly\"](https://tools.ietf.org/html/draft-handrews-json-schema-validation-02#section-9.4).",
"type": "boolean" "type": "boolean"
} }
}, },
"additionalProperties": true "additionalProperties": true
}, },
"SingleOrVec_for_InstanceType": { "SingleOrVec_for_InstanceType": {
"description": "A type which can be serialized as a single item, or multiple items.\n\nIn some contexts, a `Single` may be semantically distinct from a `Vec` containing only item.",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/InstanceType" "$ref": "#/definitions/InstanceType"
@ -635,6 +732,7 @@
] ]
}, },
"SingleOrVec_for_Schema": { "SingleOrVec_for_Schema": {
"description": "A type which can be serialized as a single item, or multiple items.\n\nIn some contexts, a `Single` may be semantically distinct from a `Vec` containing only item.",
"anyOf": [ "anyOf": [
{ {
"$ref": "#/definitions/Schema" "$ref": "#/definitions/Schema"

View file

@ -143,7 +143,7 @@ fn schema_for_external_tagged_enum<'a>(
schemas.extend(complex_variants.into_iter().map(|variant| { schemas.extend(complex_variants.into_iter().map(|variant| {
let name = variant.attrs.name().deserialize_name(); let name = variant.attrs.name().deserialize_name();
let sub_schema = schema_for_untagged_enum_variant(variant, cattrs); let sub_schema = schema_for_untagged_enum_variant(variant, cattrs);
wrap_schema_fields(quote! { let schema_expr = wrap_schema_fields(quote! {
instance_type: Some(schemars::schema::InstanceType::Object.into()), instance_type: Some(schemars::schema::InstanceType::Object.into()),
object: Some(Box::new(schemars::schema::ObjectValidation { object: Some(Box::new(schemars::schema::ObjectValidation {
properties: { properties: {
@ -158,7 +158,8 @@ fn schema_for_external_tagged_enum<'a>(
}, },
..Default::default() ..Default::default()
})), })),
}) });
metadata::set_metadata_on_schema_from_docs(schema_expr, &variant.original.attrs)
})); }));
wrap_schema_fields(quote! { wrap_schema_fields(quote! {
@ -180,6 +181,7 @@ fn schema_for_internal_tagged_enum<'a>(
instance_type: Some(schemars::schema::InstanceType::String.into()), instance_type: Some(schemars::schema::InstanceType::String.into()),
enum_values: Some(vec![#name.into()]), enum_values: Some(vec![#name.into()]),
}); });
let tag_schema = wrap_schema_fields(quote! { let tag_schema = wrap_schema_fields(quote! {
instance_type: Some(schemars::schema::InstanceType::Object.into()), instance_type: Some(schemars::schema::InstanceType::Object.into()),
object: Some(Box::new(schemars::schema::ObjectValidation { object: Some(Box::new(schemars::schema::ObjectValidation {
@ -196,6 +198,8 @@ fn schema_for_internal_tagged_enum<'a>(
..Default::default() ..Default::default()
})), })),
}); });
let tag_schema = metadata::set_metadata_on_schema_from_docs(tag_schema, &variant.original.attrs);
let variant_schema = match variant.style { let variant_schema = match variant.style {
Style::Unit => return tag_schema, Style::Unit => return tag_schema,
Style::Newtype => { Style::Newtype => {
@ -225,7 +229,10 @@ fn schema_for_untagged_enum<'a>(
variants: impl Iterator<Item = &'a Variant<'a>>, variants: impl Iterator<Item = &'a Variant<'a>>,
cattrs: &attr::Container, cattrs: &attr::Container,
) -> TokenStream { ) -> TokenStream {
let schemas = variants.map(|v| schema_for_untagged_enum_variant(v, cattrs)); let schemas = variants.map(|variant| {
let schema_expr = schema_for_untagged_enum_variant(variant, cattrs);
metadata::set_metadata_on_schema_from_docs(schema_expr, &variant.original.attrs)
});
wrap_schema_fields(quote! { wrap_schema_fields(quote! {
subschemas: Some(Box::new(schemars::schema::SubschemaValidation { subschemas: Some(Box::new(schemars::schema::SubschemaValidation {
@ -251,6 +258,7 @@ fn schema_for_unit_struct() -> TokenStream {
} }
fn schema_for_newtype_struct(field: &Field) -> TokenStream { fn schema_for_newtype_struct(field: &Field) -> TokenStream {
// TODO metadata from docs?
let ty = get_json_schema_type(field); let ty = get_json_schema_type(field);
quote_spanned! {field.original.span()=> quote_spanned! {field.original.span()=>
gen.subschema_for::<#ty>() gen.subschema_for::<#ty>()
@ -258,6 +266,7 @@ fn schema_for_newtype_struct(field: &Field) -> TokenStream {
} }
fn schema_for_tuple_struct(fields: &[Field]) -> TokenStream { fn schema_for_tuple_struct(fields: &[Field]) -> TokenStream {
// TODO metadata from docs?
let types = fields let types = fields
.iter() .iter()
.filter(|f| !f.attrs.skip_deserializing()) .filter(|f| !f.attrs.skip_deserializing())