pub struct SchemaRegistry { /* private fields */ }Expand description
Collects named schema definitions while schemas are generated.
Implementations§
Source§impl SchemaRegistry
impl SchemaRegistry
Sourcepub fn subschema<T: Schema + ?Sized + 'static>(&mut self) -> SchemaObject
pub fn subschema<T: Schema + ?Sized + 'static>(&mut self) -> SchemaObject
Schema to embed for T: a $ref if T is named, otherwise inline.
Sourcepub fn add_security_scheme(&mut self, name: &str, scheme: Value)
pub fn add_security_scheme(&mut self, name: &str, scheme: Value)
Register an OpenAPI security scheme under name
(components.securitySchemes).
Registering the same definition twice is a no-op; a different
definition under an existing name is recorded as a SchemaConflict.
Sourcepub fn take_security_schemes(&mut self) -> BTreeMap<String, Value>
pub fn take_security_schemes(&mut self) -> BTreeMap<String, Value>
Remove and return every registered security scheme.
Sourcepub fn into_components(
self,
) -> Result<BTreeMap<String, SchemaObject>, Vec<SchemaConflict>>
pub fn into_components( self, ) -> Result<BTreeMap<String, SchemaObject>, Vec<SchemaConflict>>
Consume the registry, returning components.schemas.
§Errors
Returns every SchemaConflict detected during generation.
Trait Implementations§
Source§impl Clone for SchemaRegistry
impl Clone for SchemaRegistry
Source§fn clone(&self) -> SchemaRegistry
fn clone(&self) -> SchemaRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SchemaRegistry
impl Debug for SchemaRegistry
Source§impl Default for SchemaRegistry
impl Default for SchemaRegistry
Source§fn default() -> SchemaRegistry
fn default() -> SchemaRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SchemaRegistry
impl RefUnwindSafe for SchemaRegistry
impl Send for SchemaRegistry
impl Sync for SchemaRegistry
impl Unpin for SchemaRegistry
impl UnsafeUnpin for SchemaRegistry
impl UnwindSafe for SchemaRegistry
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
Mutably borrows from an owned value. Read more