Struct utoipa::openapi::schema::Components
source · #[non_exhaustive]pub struct Components {
pub schemas: BTreeMap<String, RefOr<Schema>>,
pub responses: BTreeMap<String, RefOr<Response>>,
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: BTreeMap<String, RefOr<Schema>>
Map of reusable OpenAPI Schema Objects.
responses: BTreeMap<String, RefOr<Response>>
Map 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 Components
.
sourcepub fn add_security_scheme<N: Into<String>, S: Into<SecurityScheme>>(
&mut self,
name: N,
security_schema: S,
)
pub fn add_security_scheme<N: Into<String>, S: Into<SecurityScheme>>( &mut self, name: N, security_schema: 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<I: IntoIterator<Item = (N, S)>, N: Into<String>, S: Into<SecurityScheme>>(
&mut self,
schemas: I,
)
pub fn add_security_schemes_from_iter<I: IntoIterator<Item = (N, S)>, N: Into<String>, S: Into<SecurityScheme>>( &mut self, schemas: I, )
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
.
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 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 From<Components> for ComponentsBuilder
impl From<Components> for ComponentsBuilder
source§fn from(value: Components) -> Self
fn from(value: Components) -> Self
source§impl From<ComponentsBuilder> for Components
impl From<ComponentsBuilder> for Components
source§fn from(value: ComponentsBuilder) -> Self
fn from(value: ComponentsBuilder) -> Self
source§impl PartialEq for Components
impl PartialEq for Components
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)