#[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: Schemas
Map of reusable OpenAPI Schema Objects.
responses: Responses
Map 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 SecurityRequirement
s. 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 SecurityScheme
s to Components
.
Accepts two arguments where first is the name of the SecurityScheme
. This is later when
referenced by SecurityRequirement
s. 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.
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