#[non_exhaustive]pub struct Components {
pub schemas: IndexMap<String, Schema>,
pub responses: IndexMap<String, RefOr<Response>>,
pub security_schemes: IndexMap<String, SecurityScheme>,
pub extensions: Option<Extensions>,
}
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: IndexMap<String, Schema>
Map of reusable OpenAPI Schema Objects.
responses: IndexMap<String, RefOr<Response>>
Map of reusable response name, to OpenAPI Response Objects or OpenAPI References to OpenAPI Response Objects.
security_schemes: IndexMap<String, SecurityScheme>
Map of reusable OpenAPI Security Scheme Objects.
extensions: Option<Extensions>
Optional extensions “x-something”.
Implementations§
Source§impl Components
impl Components
Sourcepub fn builder() -> ComponentsBuilder
pub fn builder() -> ComponentsBuilder
Create an instance of Components
using the builder syntax
Source§impl Components
impl Components
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a new Components
.
Sourcepub fn add_security_scheme<N: Into<String>, S: Into<SecurityScheme>>(
&mut self,
name: N,
security_scheme: S,
)
pub fn add_security_scheme<N: Into<String>, S: Into<SecurityScheme>>( &mut self, name: N, security_scheme: S, )
Add SecurityScheme
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_security_schemes_from_iter<N: Into<String>, S: Into<SecurityScheme>>(
&mut self,
schemas: impl IntoIterator<Item = (N, S)>,
)
pub fn add_security_schemes_from_iter<N: Into<String>, S: Into<SecurityScheme>>( &mut self, schemas: impl IntoIterator<Item = (N, S)>, )
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.requirement
]s. Second parameter is the SecurityScheme
.
Sourcepub fn add_schema<N: Into<String>, S: Into<Schema>>(
&mut self,
name: N,
scheme: S,
)
pub fn add_schema<N: Into<String>, S: Into<Schema>>( &mut self, name: N, scheme: S, )
Add Schema
to Components
.
Accepts two arguments where first is the name of the Schema
. This is later when
referenced by [Ref.ref_location
]s. Second parameter is the Schema
.
Sourcepub fn add_schemas_from_iter<N: Into<String>, S: Into<Schema>>(
&mut self,
schemas: impl IntoIterator<Item = (N, S)>,
)
pub fn add_schemas_from_iter<N: Into<String>, S: Into<Schema>>( &mut self, schemas: impl IntoIterator<Item = (N, S)>, )
Add iterator of Schema
s to Components
.
Accepts two arguments where first is the name of the Schema
. This is later when
referenced by [Ref.ref_location
]s. Second parameter is the Schema
.
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