diff --git a/README.md b/README.md index 2bd7d235..9f409b96 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Spectree +# SpecTree [![GitHub Actions](https://github.com/0b01001001/spectree/workflows/Python%20package/badge.svg)](https://github.com/0b01001001/spectree/actions) diff --git a/docs/source/index.rst b/docs/source/index.rst index 83352eae..1c5868e1 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -95,6 +95,7 @@ cases, in Starlette are lower cases. config response plugins + models utils diff --git a/docs/source/models.rst b/docs/source/models.rst new file mode 100644 index 00000000..be0743d9 --- /dev/null +++ b/docs/source/models.rst @@ -0,0 +1,5 @@ +Models +========== + +.. automodule:: spectree.models + :members: diff --git a/spectree/config.py b/spectree/config.py index f910b794..7c3be926 100644 --- a/spectree/config.py +++ b/spectree/config.py @@ -8,40 +8,73 @@ class ModeEnum(str, Enum): + """the mode of the SpecTree validator""" + + #: includes undecorated routes and routes decorated by this instance normal = "normal" + #: only includes routes decorated by this instance strict = "strict" + #: includes all the routes greedy = "greedy" class Contact(BaseModel): + """contact information""" + + #: name of the contact name: str - url: AnyUrl = "" - email: EmailStr = "" + #: contact url + url: AnyUrl = None + #: contact email address + email: EmailStr = None class License(BaseModel): + """license information""" + + #: name of the license name: str - url: AnyUrl = "" + #: license url + url: AnyUrl = None class Configuration(BaseSettings): # OpenAPI configurations + #: title of the service title: str = "Service API Document" + #: service OpenAPI document description description: str = None + #: service version version: str = "0.1.0" + #: terms of service url terms_of_service: AnyUrl = None + #: author contact information contact: Contact = None + #: license information license: License = None # SpecTree configurations + #: OpenAPI doc route path prefix (i.e. /apidoc/) path: str = "apidoc" + #: OpenAPI file route path suffix (i.e. /apidoc/openapi.json) filename: str = "openapi.json" + #: OpenAPI version (doesn't affect anything) openapi_version: str = "3.0.3" + #: the mode of the SpecTree validator :class:`ModeEnum` mode: ModeEnum = ModeEnum.normal + #: 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 page_templates = DEFAULT_PAGE_TEMPLATES + #: opt-in type annotation feature, see the README examples annotations = False + #: servers section of OAS :py:class:`spectree.models.Server` servers: Optional[List[Server]] = [] + #: OpenAPI `securitySchemes` :py:class:`spectree.models.SecurityScheme` security_schemes: Optional[List[SecurityScheme]] = None + #: OpenAPI `security` JSON at the global level security: Dict = {} class Config: