pub struct OpenApiGenerator { /* private fields */ }Expand description
OpenAPI generator bound to a set of ingress route descriptors.
Implementations§
Source§impl OpenApiGenerator
impl OpenApiGenerator
pub fn from_descriptors(routes: Vec<HttpRouteDescriptor>) -> Self
pub fn from_ingress<R>(ingress: &HttpIngress<R>) -> Self
pub fn title(self, title: impl Into<String>) -> Self
pub fn version(self, version: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
pub fn with_schematic(self, schematic: &Schematic) -> Self
pub fn summary( self, method: Method, path_pattern: impl AsRef<str>, summary: impl Into<String>, ) -> Self
pub fn json_request_schema<T>(
self,
method: Method,
path_pattern: impl AsRef<str>,
) -> Selfwhere
T: JsonSchema,
Sourcepub fn json_request_schema_from_extractor<T>(
self,
method: Method,
path_pattern: impl AsRef<str>,
) -> Selfwhere
T: FromRequest + JsonSchema,
pub fn json_request_schema_from_extractor<T>(
self,
method: Method,
path_pattern: impl AsRef<str>,
) -> Selfwhere
T: FromRequest + JsonSchema,
Register JSON request schema using a FromRequest implementor type.
pub fn json_response_schema<T>(
self,
method: Method,
path_pattern: impl AsRef<str>,
) -> Selfwhere
T: JsonSchema,
Sourcepub fn json_response_schema_from_into_response<T>(
self,
method: Method,
path_pattern: impl AsRef<str>,
) -> Selfwhere
T: IntoResponse + JsonSchema,
pub fn json_response_schema_from_into_response<T>(
self,
method: Method,
path_pattern: impl AsRef<str>,
) -> Selfwhere
T: IntoResponse + JsonSchema,
Register JSON response schema using an IntoResponse implementor type.
Sourcepub fn with_bearer_auth(self) -> Self
pub fn with_bearer_auth(self) -> Self
Add a Bearer token SecurityScheme (bearerAuth) to the spec.
When enabled, each operation will reference the bearerAuth security scheme,
and the Swagger UI will show a token input.
Sourcepub fn with_problem_detail_errors(self) -> Self
pub fn with_problem_detail_errors(self) -> Self
Add RFC 7807 ProblemDetail error schemas for 4xx/5xx responses.
When enabled, every operation gets 400, 404, and 500 response entries
with a ProblemDetail JSON schema.
pub fn build(self) -> OpenApiDocument
pub fn build_json(self) -> Value
pub fn build_pretty_json(self) -> String
Trait Implementations§
Source§impl Clone for OpenApiGenerator
impl Clone for OpenApiGenerator
Source§fn clone(&self) -> OpenApiGenerator
fn clone(&self) -> OpenApiGenerator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OpenApiGenerator
impl RefUnwindSafe for OpenApiGenerator
impl Send for OpenApiGenerator
impl Sync for OpenApiGenerator
impl Unpin for OpenApiGenerator
impl UnsafeUnpin for OpenApiGenerator
impl UnwindSafe for OpenApiGenerator
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