pub struct OpenApi3Generator;Expand description
Renders the registry contents as an OpenAPI 3.1 JSON document.
Only routes with a non-empty group are emitted, and routes owned by the documentation controller itself are skipped. The result is built fresh on every call; the documentation controller caches the rendered string.
Implementations§
Source§impl OpenApi3Generator
impl OpenApi3Generator
Sourcepub fn generate(registrant: &DocumentationRegistrant) -> Value
pub fn generate(registrant: &DocumentationRegistrant) -> Value
Generates an OpenAPI 3.1 document from the registrant.
Uses the application environment for the info.title and
info.version when available, falling back to "API Documentation" /
"1.0.0".
ⓘ
let spec = crate::doc::OpenApi3Generator::generate(®istrant);
assert_eq!(spec["openapi"], "3.1.0");Sourcepub fn generate_with_title(
registrant: &DocumentationRegistrant,
title: &str,
version: &str,
) -> Value
pub fn generate_with_title( registrant: &DocumentationRegistrant, title: &str, version: &str, ) -> Value
Generates an OpenAPI 3.1 document with an explicit title and version.
Behaves as generate but overrides the info.title
and info.version taken from the environment.
Auto Trait Implementations§
impl Freeze for OpenApi3Generator
impl RefUnwindSafe for OpenApi3Generator
impl Send for OpenApi3Generator
impl Sync for OpenApi3Generator
impl Unpin for OpenApi3Generator
impl UnsafeUnpin for OpenApi3Generator
impl UnwindSafe for OpenApi3Generator
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more