From 757d9b4769acdf6220013b6817a7d5a43cbe4431 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sat, 24 Nov 2018 08:12:23 +0100 Subject: [PATCH] ArraySchema: Add min_length and max_length --- src/api/schema.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/api/schema.rs b/src/api/schema.rs index 0142a2b8..99caa8c4 100644 --- a/src/api/schema.rs +++ b/src/api/schema.rs @@ -141,6 +141,8 @@ impl StringSchema { pub struct ArraySchema { pub description: &'static str, pub items: Arc, + pub min_length: Option, + pub max_length: Option, } impl ArraySchema { @@ -149,8 +151,20 @@ impl ArraySchema { ArraySchema { description: description, 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)]