Config

class spectree.config.Configuration[source]
additional_query_string_params: Dict[str, str]

OAuth2 additional query string params

annotations: bool

opt-in type annotation feature, see the README examples

app_name: str

OAuth2 app name

client_id: str

OAuth2 client id

client_secret: str

OAuth2 client secret

contact: Contact | None

author contact information

description: str | None

service OpenAPI document description

filename: str

OpenAPI file route path suffix (i.e. /apidoc/openapi.json)

license: License | None

license information

mode: ModeEnum

the mode of the SpecTree validator ModeEnum

openapi_version: str

OpenAPI version (doesn’t affect anything)

page_templates: Dict[str, str]

A dictionary of documentation page templates. The key is the name of the template, that is also used in the URL path, while the value is used to render the documentation page content. (Each page template should contain a {spec_url} placeholder, that’ll be replaced by the actual OpenAPI spec URL in the rendered documentation page

path: str

OpenAPI doc route path prefix (i.e. /apidoc/)

realm: str

OAuth2 realm

scope_separator: str

OAuth2 scope separator

scopes: List[str]

OAuth2 scopes

security: Dict[str, List[str]] | List[Dict[str, List[str]]]

OpenAPI security JSON at the global level

security_schemes: List[SecurityScheme] | None

OpenAPI securitySchemes spectree.models.SecurityScheme

servers: List[Server] | None

servers section of OAS spectree.models.Server

swagger_oauth2_config() Dict[str, str][source]

return the swagger UI OAuth2 configs

ref: https://swagger.io/docs/open-source-tools/swagger-ui/usage/oauth2/

terms_of_service: AnyUrl | None

terms of service url

title: str

title of the service

use_basic_authentication_with_access_code_grant: bool

OAuth2 use basic authentication with access code grant

use_pkce_with_authorization_code_grant: bool

OAuth2 use PKCE with authorization code grant

version: str

service version

class spectree.config.Contact[source]

contact information

email: EmailStr | None

contact email address

name: str

name of the contact

url: AnyUrl | None

contact url

class spectree.config.License[source]

license information

name: str

name of the license

url: AnyUrl | None

license url

class spectree.config.ModeEnum[source]

the mode of the SpecTree validator

__new__(value)
greedy = 'greedy'

includes all the routes

normal = 'normal'

includes undecorated routes and routes decorated by this instance

strict = 'strict'

only includes routes decorated by this instance