Implement JsonSchema on indexmap types
This commit is contained in:
parent
8d0ccc89db
commit
fd42debc4d
8 changed files with 60 additions and 1 deletions
24
schemars/tests/expected/indexmap.json
Normal file
24
schemars/tests/expected/indexmap.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "IndexMapTypes",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"map",
|
||||
"set"
|
||||
],
|
||||
"properties": {
|
||||
"map": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"set": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"format": "int"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
schemars/tests/indexmap.rs
Normal file
15
schemars/tests/indexmap.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
mod util;
|
||||
use indexmap::{IndexMap, IndexSet};
|
||||
use schemars::JsonSchema;
|
||||
use util::*;
|
||||
|
||||
#[derive(Debug, JsonSchema)]
|
||||
struct IndexMapTypes {
|
||||
map: IndexMap<i32, bool>,
|
||||
set: IndexSet<isize>,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn chrono_types() -> TestResult {
|
||||
test_default_generated_schema::<IndexMapTypes>("indexmap")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue