[][src]Trait paperclip::v2::Schema

pub trait Schema: Sized {
    fn description(&self) -> Option<&str>;
fn reference(&self) -> Option<&str>;
fn data_type(&self) -> Option<DataType>;
fn format(&self) -> Option<&DataTypeFormat>;
fn items(&self) -> Option<&SchemaRepr<Self>>;
fn items_mut(&mut self) -> Option<&mut SchemaRepr<Self>>;
fn additional_properties(&self) -> Option<&SchemaRepr<Self>>;
fn additional_properties_mut(&mut self) -> Option<&mut SchemaRepr<Self>>;
fn properties(&self) -> Option<&BTreeMap<String, SchemaRepr<Self>>>;
fn properties_mut(
        &mut self
    ) -> Option<&mut BTreeMap<String, SchemaRepr<Self>>>;
fn required_properties(&self) -> Option<&BTreeSet<String>>;
fn set_cyclic(&mut self, cyclic: bool);
fn is_cyclic(&self) -> bool;
fn name(&self) -> Option<&str>;
fn set_name(&mut self, name: &str); }

Interface for the Schema object.

This is only used for resolving the definitions.

NOTE: Don't implement this by yourself! Please use the #[api_v2_schema] proc macro attribute instead.

Required methods

fn description(&self) -> Option<&str>

Description for this schema, if any (description field).

fn reference(&self) -> Option<&str>

Reference to some other schema, if any ($ref field).

fn data_type(&self) -> Option<DataType>

Data type of this schema, if any (type field).

fn format(&self) -> Option<&DataTypeFormat>

Data type format used by this schema, if any (format field).

fn items(&self) -> Option<&SchemaRepr<Self>>

Schema for array definitions, if any (items field).

fn items_mut(&mut self) -> Option<&mut SchemaRepr<Self>>

Mutable access to the items field, if it exists.

fn additional_properties(&self) -> Option<&SchemaRepr<Self>>

Value schema for maps (additional_properties field).

fn additional_properties_mut(&mut self) -> Option<&mut SchemaRepr<Self>>

Mutable access to additional_properties field, if it's a map.

fn properties(&self) -> Option<&BTreeMap<String, SchemaRepr<Self>>>

Map of names and schema for properties, if it's an object (properties field)

fn properties_mut(&mut self) -> Option<&mut BTreeMap<String, SchemaRepr<Self>>>

Mutable access to properties field.

fn required_properties(&self) -> Option<&BTreeSet<String>>

Returns the required properties (if any) for this object.

fn set_cyclic(&mut self, cyclic: bool)

Set whether this definition is cyclic. This is done by the resolver.

fn is_cyclic(&self) -> bool

Returns whether this definition is cyclic.

NOTE: This is not part of the schema object, but it's set by the resolver using set_cyclic for codegen.

fn name(&self) -> Option<&str>

Name of this schema, if any.

NOTE: This is not part of the schema object, but it's set by the resolver using set_name for codegen.

fn set_name(&mut self, name: &str)

Sets the name for this schema. This is done by the resolver.

Loading content...

Implementors

impl Schema for DefaultSchema[src]

Loading content...