This commit is contained in:
Graham Esau 2019-10-23 22:34:40 +01:00
parent ec42b51bf5
commit 1d8d996983
3 changed files with 36 additions and 36 deletions

View file

@ -40,28 +40,6 @@ fn main() {
{ {
"$schema": "http://json-schema.org/draft-07/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"title": "MyStruct", "title": "MyStruct",
"definitions": {
"MyEnum": {
"anyOf": [
{
"enum": [
"Unit"
]
},
{
"type": "object",
"required": [
"StringNewType"
],
"properties": {
"StringNewType": {
"type": "string"
}
}
}
]
}
},
"type": "object", "type": "object",
"required": [ "required": [
"my_bool", "my_bool",
@ -86,6 +64,28 @@ fn main() {
} }
] ]
} }
},
"definitions": {
"MyEnum": {
"anyOf": [
{
"enum": [
"Unit"
]
},
{
"type": "object",
"required": [
"StringNewType"
],
"properties": {
"StringNewType": {
"type": "string"
}
}
}
]
}
} }
} }
``` ```
@ -130,18 +130,6 @@ fn main() {
{ {
"$schema": "http://json-schema.org/draft-07/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"title": "MyStruct", "title": "MyStruct",
"definitions": {
"MyEnum": {
"anyOf": [
{
"type": "null"
},
{
"type": "string"
}
]
}
},
"type": "object", "type": "object",
"required": [ "required": [
"myBool", "myBool",
@ -165,6 +153,18 @@ fn main() {
"type": "integer", "type": "integer",
"format": "int32" "format": "int32"
} }
},
"definitions": {
"MyEnum": {
"anyOf": [
{
"type": "null"
},
{
"type": "string"
}
]
}
} }
} }
``` ```

View file

@ -2,7 +2,7 @@
name = "schemars" name = "schemars"
description = "Generate JSON Schemas from Rust code" description = "Generate JSON Schemas from Rust code"
repository = "https://github.com/GREsau/schemars" repository = "https://github.com/GREsau/schemars"
version = "0.3.0" version = "0.4.0"
authors = ["Graham Esau <gesau@hotmail.co.uk>"] authors = ["Graham Esau <gesau@hotmail.co.uk>"]
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"

View file

@ -2,7 +2,7 @@
name = "schemars_derive" name = "schemars_derive"
description = "Macros for #[derive(JsonSchema)], for use with schemars" description = "Macros for #[derive(JsonSchema)], for use with schemars"
repository = "https://github.com/GREsau/schemars" repository = "https://github.com/GREsau/schemars"
version = "0.3.0" version = "0.4.0"
authors = ["Graham Esau <gesau@hotmail.co.uk>"] authors = ["Graham Esau <gesau@hotmail.co.uk>"]
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"