pub struct OpenApiConfig {
pub enabled: bool,
pub title: String,
pub version: String,
pub description: Option<String>,
pub openapi_path: String,
pub servers: Vec<(String, Option<String>)>,
pub tags: Vec<(String, Option<String>)>,
}Expand description
Configuration for OpenAPI documentation generation.
When enabled, the application will automatically generate an OpenAPI 3.1
specification and serve it at the configured endpoint (default /openapi.json).
§Example
ⓘ
use fastapi_core::app::{App, OpenApiConfig};
let app = App::builder()
.openapi(OpenApiConfig::new()
.title("My API")
.version("1.0.0")
.description("A sample API"))
.build();Fields§
§enabled: boolWhether OpenAPI documentation is enabled.
title: StringAPI title for the OpenAPI spec.
version: StringAPI version for the OpenAPI spec.
description: Option<String>API description.
openapi_path: StringPath to serve the OpenAPI JSON (default: “/openapi.json”).
servers: Vec<(String, Option<String>)>Servers to include in the spec.
Tags for organizing operations.
Implementations§
Source§impl OpenApiConfig
impl OpenApiConfig
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Set the API description.
Sourcepub fn server(self, url: impl Into<String>, description: Option<String>) -> Self
pub fn server(self, url: impl Into<String>, description: Option<String>) -> Self
Add a server to the spec.
Trait Implementations§
Source§impl Clone for OpenApiConfig
impl Clone for OpenApiConfig
Source§fn clone(&self) -> OpenApiConfig
fn clone(&self) -> OpenApiConfig
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 moreSource§impl Debug for OpenApiConfig
impl Debug for OpenApiConfig
Auto Trait Implementations§
impl Freeze for OpenApiConfig
impl RefUnwindSafe for OpenApiConfig
impl Send for OpenApiConfig
impl Sync for OpenApiConfig
impl Unpin for OpenApiConfig
impl UnwindSafe for OpenApiConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).