#[non_exhaustive]pub struct Components {
pub schemas: Schemas,
pub responses: Responses,
pub security_schemes: PropMap<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: PropMap<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 more