pub struct Schema {
pub data: SchemaData,
pub kind: SchemaKind,
}
Fields§
§data: SchemaData
§kind: SchemaKind
Implementations§
Source§impl Schema
impl Schema
pub fn new_number() -> Schema
pub fn new_integer() -> Schema
pub fn new_bool() -> Schema
pub fn new_str_enum(enumeration: Vec<String>) -> Schema
pub fn new_string() -> Schema
Sourcepub fn new_object() -> Schema
pub fn new_object() -> Schema
Create a schemaless object schema
Sourcepub fn new_map_any() -> Schema
pub fn new_map_any() -> Schema
Create a Map<String, Any> schema
Sourcepub fn new_array_any() -> Schema
pub fn new_array_any() -> Schema
Create an Array
Sourcepub fn new_array(inner: impl Into<RefOr<Schema>>) -> Schema
pub fn new_array(inner: impl Into<RefOr<Schema>>) -> Schema
Create a new array schema with items of the given type
pub fn new_one_of(one_of: Vec<RefOr<Schema>>) -> Schema
pub fn new_all_of(all_of: Vec<RefOr<Schema>>) -> Schema
pub fn new_any_of(any_of: Vec<RefOr<Schema>>) -> Schema
pub fn with_format(self, format: &str) -> Schema
pub fn is_empty(&self) -> bool
Source§impl Schema
impl Schema
pub fn properties(&self) -> &RefOrMap<Schema>
pub fn get_properties(&self) -> Option<&RefOrMap<Schema>>
pub fn get_properties_mut(&mut self) -> Option<&mut RefOrMap<Schema>>
pub fn properties_mut(&mut self) -> &mut RefOrMap<Schema>
pub fn properties_iter<'a>( &'a self, spec: &'a OpenAPI, ) -> Box<dyn Iterator<Item = (&'a String, &'a RefOr<Schema>)> + 'a>
pub fn is_required(&self, field: &str) -> bool
pub fn get_required(&self) -> Option<&Vec<String>>
pub fn required(&self) -> &Vec<String>
pub fn get_required_mut(&mut self) -> Option<&mut Vec<String>>
pub fn required_mut(&mut self) -> &mut Vec<String>
pub fn add_required(&mut self, field: &str)
pub fn remove_required(&mut self, field: &str)
pub fn is_anonymous_object(&self) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Schema
impl<'de> Deserialize<'de> for Schema
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Schema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Schema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Schema
impl Serialize for Schema
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Schema
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnwindSafe for Schema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more