diff --git a/src/api/schema.rs b/src/api/schema.rs index 1691354d..cd55eb01 100644 --- a/src/api/schema.rs +++ b/src/api/schema.rs @@ -155,6 +155,20 @@ pub struct ArraySchema { pub items: Arc, } +impl ArraySchema { + + pub fn new(description: &'static str, item_schema: Arc) -> Self { + ArraySchema { + description: description, + items: item_schema, + } + } + + pub fn arc(self) -> Arc { + Arc::new(self.into()) + } +} + #[derive(Debug)] pub struct ObjectSchema { pub description: &'static str, @@ -227,6 +241,12 @@ impl From for Schema { } } +impl From for Schema { + fn from(array_schema: ArraySchema) -> Self { + Schema::Array(array_schema) + } +} + pub enum ApiStringFormat { Enum(Vec), Pattern(Box),