Skip to main content

OpenApiRegistry

Struct OpenApiRegistry 

Source
pub struct OpenApiRegistry { /* private fields */ }
Expand description

OpenAPI runtime registry.

Implementations§

Source§

impl OpenApiRegistry

Source

pub fn new(config: OpenApiConfig) -> Self

Creates a new OpenApiRegistry

Source

pub fn register_route( &self, method: &Method, path: &str, cfg: &OpenApiRouteConfig, )

Registers a route in the OpenAPI registry.

Source

pub fn describe_route_in( &self, method: &Method, path: &str, cfg: &OpenApiRouteConfig, docs: &[&str], )

Registers a route in docs alone and applies its configuration there.

docs is meant to be some of the documents cfg names - see Self::docs_for - for a route that has to be left out of the rest. A name no document carries is skipped.

Source

pub fn docs_for<'a>(&'a self, cfg: &'a OpenApiRouteConfig) -> Vec<&'a str>

Returns the names of the documents a route configured with cfg is described in: the ones it is bound to, or the first spec when it is bound to none.

Source

pub fn rebind_route( &self, method: &Method, path: &str, cfg: &OpenApiRouteConfig, )

Rebinds route to another spec.

Source

pub fn remove_route(&self, method: &Method, path: &str)

Removes a route’s operation from every spec.

A route that is not in a spec is left out of it, so removing one that was never registered does nothing.

Source

pub fn apply_route_config( &self, method: &Method, path: &str, cfg: &OpenApiRouteConfig, )

Applies route configuration

Source

pub fn document_by_name(&self, name: &str) -> Option<OpenApiDocument>

Returns OpenAPI document by spec name.

Source

pub fn specs(&self) -> &[OpenApiSpec]

Returns a list of defined specs

Trait Implementations§

Source§

impl Clone for OpenApiRegistry

Source§

fn clone(&self) -> OpenApiRegistry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OpenApiRegistry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.