implement ArraySchema
This commit is contained in:
parent
7edeec7b06
commit
8a41cfdd55
|
@ -155,6 +155,20 @@ pub struct ArraySchema {
|
|||
pub items: Arc<Schema>,
|
||||
}
|
||||
|
||||
impl ArraySchema {
|
||||
|
||||
pub fn new(description: &'static str, item_schema: Arc<Schema>) -> Self {
|
||||
ArraySchema {
|
||||
description: description,
|
||||
items: item_schema,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn arc(self) -> Arc<Schema> {
|
||||
Arc::new(self.into())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ObjectSchema {
|
||||
pub description: &'static str,
|
||||
|
@ -227,6 +241,12 @@ impl From<ObjectSchema> for Schema {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<ArraySchema> for Schema {
|
||||
fn from(array_schema: ArraySchema) -> Self {
|
||||
Schema::Array(array_schema)
|
||||
}
|
||||
}
|
||||
|
||||
pub enum ApiStringFormat {
|
||||
Enum(Vec<String>),
|
||||
Pattern(Box<Regex>),
|
||||
|
|
Loading…
Reference in New Issue