Set type on enum schemas (#28)

This commit is contained in:
Graham Esau 2020-05-16 10:41:30 +01:00
parent f4c8e7d4d3
commit ea351f3b42
7 changed files with 7 additions and 0 deletions

View file

@ -4,6 +4,7 @@
"description": "This is the enum's description.",
"anyOf": [
{
"type": "string",
"enum": [
"UndocumentedUnit",
"DocumentedUnit"

View file

@ -3,6 +3,7 @@
"title": "External",
"anyOf": [
{
"type": "string",
"enum": [
"unitOne",
"unitTwo"

View file

@ -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",

View file

@ -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",

View file

@ -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",

View file

@ -3,6 +3,7 @@
"title": "MyEnum",
"anyOf": [
{
"type": "string",
"enum": [
"Included2"
]

View file

@ -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()),*]),
});