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