Implement JsonSchema on smallvec + arrayvec types

Documentation still needs updating.
This commit is contained in:
Graham Esau 2019-12-28 20:11:38 +00:00
parent aec4824425
commit a97d54bcad
9 changed files with 99 additions and 0 deletions

View file

@ -0,0 +1,13 @@
mod util;
use arrayvec::{ArrayString, ArrayVec};
use util::*;
#[test]
fn arrayvec() -> TestResult {
test_default_generated_schema::<ArrayVec::<[i32; 16]>>("arrayvec")
}
#[test]
fn arrayvec_string() -> TestResult {
test_default_generated_schema::<ArrayString::<[u8; 16]>>("arrayvec_string")
}

View file

@ -0,0 +1,10 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Array_up_to_size_16_of_int32",
"type": "array",
"items": {
"type": "integer",
"format": "int32"
},
"maxItems": 16
}

View file

@ -0,0 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "String",
"type": "string"
}

View file

@ -0,0 +1,8 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Array_of_String",
"type": "array",
"items": {
"type": "string"
}
}

View file

@ -0,0 +1,8 @@
mod util;
use smallvec::SmallVec;
use util::*;
#[test]
fn smallvec() -> TestResult {
test_default_generated_schema::<SmallVec<[String; 2]>>("smallvec")
}