Implement JsonSchema on Either
This commit is contained in:
parent
fd42debc4d
commit
fbd019baae
8 changed files with 58 additions and 4 deletions
8
schemars/tests/either.rs
Normal file
8
schemars/tests/either.rs
Normal 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")
|
||||
}
|
20
schemars/tests/expected/either.json
Normal file
20
schemars/tests/expected/either.json
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -10,6 +10,6 @@ struct IndexMapTypes {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn chrono_types() -> TestResult {
|
||||
fn indexmap_types() -> TestResult {
|
||||
test_default_generated_schema::<IndexMapTypes>("indexmap")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue