Implement JsonSchema on smallvec + arrayvec types
Documentation still needs updating.
This commit is contained in:
parent
aec4824425
commit
a97d54bcad
9 changed files with 99 additions and 0 deletions
13
schemars/tests/arrayvec.rs
Normal file
13
schemars/tests/arrayvec.rs
Normal 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")
|
||||
}
|
10
schemars/tests/expected/arrayvec.json
Normal file
10
schemars/tests/expected/arrayvec.json
Normal 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
|
||||
}
|
5
schemars/tests/expected/arrayvec_string.json
Normal file
5
schemars/tests/expected/arrayvec_string.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "String",
|
||||
"type": "string"
|
||||
}
|
8
schemars/tests/expected/smallvec.json
Normal file
8
schemars/tests/expected/smallvec.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Array_of_String",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
8
schemars/tests/smallvec.rs
Normal file
8
schemars/tests/smallvec.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
mod util;
|
||||
use smallvec::SmallVec;
|
||||
use util::*;
|
||||
|
||||
#[test]
|
||||
fn smallvec() -> TestResult {
|
||||
test_default_generated_schema::<SmallVec<[String; 2]>>("smallvec")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue