Set type on enum schemas (#28)
This commit is contained in:
parent
f4c8e7d4d3
commit
ea351f3b42
7 changed files with 7 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
"description": "This is the enum's description.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"UndocumentedUnit",
|
||||
"DocumentedUnit"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"title": "External",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"unitOne",
|
||||
"unitTwo"
|
||||
|
|
|
@ -358,6 +358,7 @@
|
|||
"definitions": {
|
||||
"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).",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"null",
|
||||
"boolean",
|
||||
|
|
|
@ -294,6 +294,7 @@
|
|||
"definitions": {
|
||||
"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).",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"null",
|
||||
"boolean",
|
||||
|
|
|
@ -358,6 +358,7 @@
|
|||
"definitions": {
|
||||
"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).",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"null",
|
||||
"boolean",
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"title": "MyEnum",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Included2"
|
||||
]
|
||||
|
|
|
@ -89,6 +89,7 @@ fn expr_for_external_tagged_enum<'a>(
|
|||
|
||||
let unit_names = unit_variants.iter().map(|v| v.name());
|
||||
let unit_schema = schema_object(quote! {
|
||||
instance_type: Some(schemars::schema::InstanceType::String.into()),
|
||||
enum_values: Some(vec![#(#unit_names.into()),*]),
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue