Implement JsonSchema on indexmap types

This commit is contained in:
Graham Esau 2019-12-27 21:44:50 +00:00
parent 8d0ccc89db
commit fd42debc4d
8 changed files with 60 additions and 1 deletions

View 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"
}
}
}
}

View 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")
}