Struct openapi_type::OpenapiSchema
source · [−]pub struct OpenapiSchema {
pub name: Option<String>,
pub nullable: bool,
pub schema: SchemaKind,
pub dependencies: IndexMap<String, OpenapiSchema>,
}
Expand description
This struct needs to be available for every type that can be part of an OpenAPI Spec. It is already implemented for primitive types, String, Vec, Option and the like. To have it available for your type, simply derive from OpenapiType.
Fields
name: Option<String>
The name of this schema. If it is None, the schema will be inlined.
nullable: bool
Whether this particular schema is nullable. Note that there is no guarantee that this will make it into the final specification, it might just be interpreted as a hint to make it an optional parameter.
schema: SchemaKind
The actual OpenAPI schema.
dependencies: IndexMap<String, OpenapiSchema>
Other schemas that this schema depends on. They will be included in the final OpenAPI Spec along with this schema.
Implementations
sourceimpl OpenapiSchema
impl OpenapiSchema
sourcepub fn new(schema: SchemaKind) -> Self
pub fn new(schema: SchemaKind) -> Self
Create a new schema that has no name.
sourcepub fn into_schema(self) -> Schema
pub fn into_schema(self) -> Schema
Convert this schema to a Schema that can be serialized to the OpenAPI Spec.
Trait Implementations
sourceimpl Clone for OpenapiSchema
impl Clone for OpenapiSchema
sourcefn clone(&self) -> OpenapiSchema
fn clone(&self) -> OpenapiSchema
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for OpenapiSchema
impl Debug for OpenapiSchema
sourceimpl PartialEq<OpenapiSchema> for OpenapiSchema
impl PartialEq<OpenapiSchema> for OpenapiSchema
sourcefn eq(&self, other: &OpenapiSchema) -> bool
fn eq(&self, other: &OpenapiSchema) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &OpenapiSchema) -> bool
fn ne(&self, other: &OpenapiSchema) -> bool
This method tests for !=
.
impl StructuralPartialEq for OpenapiSchema
Auto Trait Implementations
impl RefUnwindSafe for OpenapiSchema
impl Send for OpenapiSchema
impl Sync for OpenapiSchema
impl Unpin for OpenapiSchema
impl UnwindSafe for OpenapiSchema
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more