ArraySchema: Add min_length and max_length
This commit is contained in:
parent
3e1497fb75
commit
757d9b4769
|
@ -141,6 +141,8 @@ impl StringSchema {
|
||||||
pub struct ArraySchema {
|
pub struct ArraySchema {
|
||||||
pub description: &'static str,
|
pub description: &'static str,
|
||||||
pub items: Arc<Schema>,
|
pub items: Arc<Schema>,
|
||||||
|
pub min_length: Option<usize>,
|
||||||
|
pub max_length: Option<usize>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ArraySchema {
|
impl ArraySchema {
|
||||||
|
@ -149,8 +151,20 @@ impl ArraySchema {
|
||||||
ArraySchema {
|
ArraySchema {
|
||||||
description: description,
|
description: description,
|
||||||
items: item_schema,
|
items: item_schema,
|
||||||
|
min_length: None,
|
||||||
|
max_length: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn min_length(mut self, min_length: usize) -> Self {
|
||||||
|
self.min_length = Some(min_length);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn max_length(mut self, max_length: usize) -> Self {
|
||||||
|
self.max_length = Some(max_length);
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
Loading…
Reference in New Issue