Struct openapi_type::OpenapiSchema
source · [−]#[non_exhaustive]pub struct OpenapiSchema {
pub name: Option<String>,
pub description: Option<String>,
pub nullable: bool,
pub schema: SchemaKind,
pub dependencies: IndexMap<String, OpenapiSchema>,
}
Expand description
This struct is used to generate the OpenAPI specification for a particular type. It is already made available for all primitives and some other types from the rust standard library, and you can also make your own types provide one through the OpenapiType trait and derive macro.
Note that this struct is marked non-exhaustive. This means that new attributes might be added at any point in time without a breaking change. The only way to obtain a value is through the OpenapiSchema::new method.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.name: Option<String>
The name of this schema. If it is None, the schema will be inlined.
description: Option<String>
The description of this schema. Optional and only makes sense when a name
is set as well.
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