Struct salvo_oapi::Components
source · #[non_exhaustive]pub struct Components {
pub schemas: Schemas,
pub responses: Responses,
pub security_schemes: BTreeMap<String, SecurityScheme>,
}Expand description
Implements OpenAPI Components Object which holds supported reusable objects.
Components can hold either reusable types themselves or references to other reusable types.
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.schemas: SchemasMap of reusable OpenAPI Schema Objects.
responses: ResponsesMap of reusable response name, to OpenAPI Response Objects or OpenAPI References to OpenAPI Response Objects.
security_schemes: BTreeMap<String, SecurityScheme>Map of reusable OpenAPI Security Scheme Objects.
Implementations§
source§impl Components
impl Components
sourcepub fn new() -> Self
pub fn new() -> Self
Construct a new empty Components. This is effectively same as calling Components::default.
sourcepub fn add_security_scheme<N: Into<String>, S: Into<SecurityScheme>>(
self,
name: N,
security_scheme: S,
) -> Self
pub fn add_security_scheme<N: Into<String>, S: Into<SecurityScheme>>( self, name: N, security_scheme: S, ) -> Self
Add SecurityScheme to Components and returns Self.
Accepts two arguments where first is the name of the SecurityScheme. This is later when
referenced by SecurityRequirements. Second parameter is the SecurityScheme.
sourcepub fn extend_security_schemes<I: IntoIterator<Item = (N, S)>, N: Into<String>, S: Into<SecurityScheme>>(
self,
schemas: I,
) -> Self
pub fn extend_security_schemes<I: IntoIterator<Item = (N, S)>, N: Into<String>, S: Into<SecurityScheme>>( self, schemas: I, ) -> Self
Add iterator of SecuritySchemes to Components.
Accepts two arguments where first is the name of the SecurityScheme. This is later when
referenced by SecurityRequirements. Second parameter is the SecurityScheme.
sourcepub fn add_schema<S: Into<String>, I: Into<RefOr<Schema>>>(
self,
name: S,
schema: I,
) -> Self
pub fn add_schema<S: Into<String>, I: Into<RefOr<Schema>>>( self, name: S, schema: I, ) -> Self
Add Schema to Components and returns Self.
Accepts two arguments where first is name of the schema and second is the schema itself.
sourcepub fn extend_schemas<I, C, S>(self, schemas: I) -> Self
pub fn extend_schemas<I, C, S>(self, schemas: I) -> Self
sourcepub fn response<S: Into<String>, R: Into<RefOr<Response>>>(
self,
name: S,
response: R,
) -> Self
pub fn response<S: Into<String>, R: Into<RefOr<Response>>>( self, name: S, response: R, ) -> Self
Add a new response and returns self.
sourcepub fn extend_responses<I: IntoIterator<Item = (S, R)>, S: Into<String>, R: Into<RefOr<Response>>>(
self,
responses: I,
) -> Self
pub fn extend_responses<I: IntoIterator<Item = (S, R)>, S: Into<String>, R: Into<RefOr<Response>>>( self, responses: I, ) -> Self
Extends responses with the contents of an iterator.
sourcepub fn append(&mut self, other: &mut Components)
pub fn append(&mut self, other: &mut Components)
Moves all elements from other into self, leaving other empty.
If a key from other is already present in self, the respective
value from self will be overwritten with the respective value from other.
Trait Implementations§
source§impl Clone for Components
impl Clone for Components
source§fn clone(&self) -> Components
fn clone(&self) -> Components
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for Components
impl Debug for Components
source§impl Default for Components
impl Default for Components
source§fn default() -> Components
fn default() -> Components
source§impl<'de> Deserialize<'de> for Components
impl<'de> Deserialize<'de> for Components
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for Components
impl PartialEq for Components
source§fn eq(&self, other: &Components) -> bool
fn eq(&self, other: &Components) -> bool
self and other values to be equal, and is used
by ==.source§impl Serialize for Components
impl Serialize for Components
impl StructuralPartialEq for Components
Auto Trait Implementations§
impl Freeze for Components
impl RefUnwindSafe for Components
impl Send for Components
impl Sync for Components
impl Unpin for Components
impl UnwindSafe for Components
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)