Implement JsonSchema on Either

This commit is contained in:
Graham Esau 2019-12-27 22:16:01 +00:00
parent fd42debc4d
commit fbd019baae
8 changed files with 58 additions and 4 deletions

8
schemars/tests/either.rs Normal file
View file

@ -0,0 +1,8 @@
mod util;
use either::Either;
use util::*;
#[test]
fn either() -> TestResult {
test_default_generated_schema::<Either<i32, Either<bool, ()>>>("either")
}

View file

@ -0,0 +1,20 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Either_int32_or_Either_Boolean_or_Null",
"anyOf": [
{
"type": "integer",
"format": "int32"
},
{
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
]
}
]
}

View file

@ -10,6 +10,6 @@ struct IndexMapTypes {
}
#[test]
fn chrono_types() -> TestResult {
fn indexmap_types() -> TestResult {
test_default_generated_schema::<IndexMapTypes>("indexmap")
}