跳转至

Models

APISpec ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#openapi-object

Source code in flask_openapi3/models/__init__.py
56
57
58
59
60
61
62
63
64
65
66
67
68
69
class APISpec(BaseModel):
    """https://spec.openapis.org/oas/v3.1.0#openapi-object"""
    openapi: str
    info: Info
    servers: Optional[List[Server]] = None
    paths: Paths
    components: Optional[Components] = None
    security: Optional[List[SecurityRequirement]] = None
    tags: Optional[List[Tag]] = None
    externalDocs: Optional[ExternalDocumentation] = None

    model_config = {
        "extra": "allow"
    }

OAuthConfig ⚓︎

Bases: BaseModel

https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/oauth2.md#oauth-20-configuration

Source code in flask_openapi3/models/__init__.py
72
73
74
75
76
77
78
79
80
81
82
83
84
class OAuthConfig(BaseModel):
    """
    https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/oauth2.md#oauth-20-configuration
    """
    clientId: Optional[str] = None
    clientSecret: Optional[str] = None
    realm: Optional[str] = None
    appName: Optional[str] = None
    scopeSeparator: Optional[str] = None
    scopes: Optional[str] = None
    additionalQueryStringParams: Optional[Dict[str, str]] = None
    useBasicAuthenticationWithAccessCodeGrant: Optional[bool] = False
    usePkceWithAuthorizationCodeGrant: Optional[bool] = False

Callback = Dict[str, PathItem] module-attribute ⚓︎

Components ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#components-object

Source code in flask_openapi3/models/components.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class Components(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#components-object
    """

    schemas: Optional[Dict[str, Union[Reference, Schema]]] = Field(None)
    responses: Optional[Dict[str, Union[Response, Reference]]] = None
    parameters: Optional[Dict[str, Union[Parameter, Reference]]] = None
    examples: Optional[Dict[str, Union[Example, Reference]]] = None
    requestBodies: Optional[Dict[str, Union[RequestBody, Reference]]] = None
    headers: Optional[Dict[str, Union[Header, Reference]]] = None
    securitySchemes: Optional[Dict[str, Union[SecurityScheme, Dict[str, Any]]]] = None
    links: Optional[Dict[str, Union[Link, Reference]]] = None
    callbacks: Optional[Dict[str, Union[Callback, Reference]]] = None
    pathItems: Optional[Dict[str, Union[PathItem, Reference]]] = None

    model_config = {
        "extra": "allow"
    }

Contact ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#contact-object

Source code in flask_openapi3/models/contact.py
 9
10
11
12
13
14
15
16
17
18
19
20
class Contact(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#contact-object
    """

    name: Optional[str] = None
    url: Optional[str] = None
    email: Optional[str] = None

    model_config = {
        "extra": "allow"
    }

Discriminator ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#discriminator-object

Source code in flask_openapi3/models/discriminator.py
 9
10
11
12
13
14
15
16
17
18
19
class Discriminator(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#discriminator-object
    """

    propertyName: str
    mapping: Optional[Dict[str, str]] = None

    model_config = {
        "extra": "allow"
    }

Encoding ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#encoding-object

Source code in flask_openapi3/models/encoding.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class Encoding(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#encoding-object
    """

    contentType: Optional[str] = None
    headers: Optional[Dict[str, Union[Header, Reference]]] = None
    style: Optional[str] = None
    explode: Optional[bool] = None
    allowReserved: bool = False

    model_config = {
        "extra": "allow"
    }

Example ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#example-object

Source code in flask_openapi3/models/example.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
class Example(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#example-object
    """

    summary: Optional[str] = None
    description: Optional[str] = None
    value: Optional[Any] = None
    externalValue: Optional[str] = None

    model_config = {
        "extra": "allow"
    }

ExternalDocumentation ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#external-documentation-object

Source code in flask_openapi3/models/external_documentation.py
 9
10
11
12
13
14
15
16
17
18
19
class ExternalDocumentation(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#external-documentation-object
    """

    description: Optional[str] = None
    url: str

    model_config = {
        "extra": "allow"
    }

FileStorage ⚓︎

Bases: FileStorage

An uploaded file included as part of the request data.

Source code in flask_openapi3/models/file.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class FileStorage(_FileStorage):
    """
    An uploaded file included as part of the request data.
    """

    @classmethod
    def __get_pydantic_json_schema__(cls, _core_schema, _handler) -> JsonSchemaValue:
        field_schema = {"format": "binary", "type": "string"}
        return field_schema

    @classmethod
    def __get_pydantic_core_schema__(cls, _source: Any) -> core_schema.CoreSchema:
        return core_schema.with_info_plain_validator_function(cls.validate)

    @classmethod
    def validate(cls, value: _FileStorage, _info: core_schema.ValidationInfo) -> _FileStorage:
        return value

Header ⚓︎

Bases: Parameter

https://spec.openapis.org/oas/v3.1.0#header-object

Source code in flask_openapi3/models/header.py
10
11
12
13
14
15
16
17
18
19
20
class Header(Parameter):
    """
    https://spec.openapis.org/oas/v3.1.0#header-object
    """

    name: Optional[str] = None  # type:ignore
    param_in: Optional[ParameterInType] = None  # type:ignore

    model_config = {
        "extra": "allow"
    }

Info ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#info-object

Source code in flask_openapi3/models/info.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class Info(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#info-object
    """

    title: str
    summary: Optional[str] = None
    description: Optional[str] = None
    termsOfService: Optional[str] = None
    contact: Optional[Contact] = None
    license: Optional[License] = None
    version: str

    model_config = {
        "extra": "allow"
    }

License ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#license-object

Source code in flask_openapi3/models/license.py
 9
10
11
12
13
14
15
16
17
18
19
20
class License(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#license-object
    """

    name: str
    identifier: Optional[str] = None
    url: Optional[str] = None

    model_config = {
        "extra": "allow"
    }

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#link-object

Source code in flask_openapi3/models/link.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Link(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#link-object
    """

    operationRef: Optional[str] = None
    operationId: Optional[str] = None
    parameters: Optional[Dict[str, Any]] = None
    requestBody: Optional[Any] = None
    description: Optional[str] = None
    server: Optional[Server] = None

    model_config = {
        "extra": "allow"
    }

MediaType ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#media-type-object

Source code in flask_openapi3/models/media_type.py
14
15
16
17
18
19
20
21
22
23
24
25
26
class MediaType(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#media-type-object
    """

    media_type_schema: Optional[Union[Reference, Schema]] = Field(default=None, alias="schema")
    example: Optional[Any] = None
    examples: Optional[Dict[str, Union[Example, Reference]]] = None
    encoding: Optional[Dict[str, Encoding]] = None

    model_config = {
        "extra": "allow"
    }

OAuthFlow ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#oauth-flow-object

Source code in flask_openapi3/models/oauth_flow.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
class OAuthFlow(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#oauth-flow-object
    """

    authorizationUrl: Optional[str] = None
    tokenUrl: Optional[str] = None
    refreshUrl: Optional[str] = None
    scopes: Dict[str, str]

    model_config = {
        "extra": "allow"
    }

OAuthFlows ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#oauth-flows-object

Source code in flask_openapi3/models/oauth_flows.py
11
12
13
14
15
16
17
18
19
20
21
22
23
class OAuthFlows(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#oauth-flows-object
    """

    implicit: Optional[OAuthFlow] = None
    password: Optional[OAuthFlow] = None
    clientCredentials: Optional[OAuthFlow] = None
    authorizationCode: Optional[OAuthFlow] = None

    model_config = {
        "extra": "allow"
    }

Operation ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#operation-object

Source code in flask_openapi3/models/operation.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class Operation(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#operation-object
    """

    tags: Optional[List[str]] = None
    summary: Optional[str] = None
    description: Optional[str] = None
    externalDocs: Optional[ExternalDocumentation] = None
    operationId: Optional[str] = None
    parameters: Optional[List[Parameter]] = None
    requestBody: Optional[Union[RequestBody, Reference]] = None
    responses: Optional[Dict[str, Response]] = None
    callbacks: Optional[Dict[str, Callback]] = None

    deprecated: Optional[bool] = False
    security: Optional[List[SecurityRequirement]] = None
    servers: Optional[List[Server]] = None

    model_config = {
        "extra": "allow"
    }

Parameter ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#parameter-object

Source code in flask_openapi3/models/parameter.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class Parameter(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#parameter-object
    """

    name: str
    param_in: ParameterInType = Field(alias="in")
    description: Optional[str] = None
    required: Optional[bool] = None
    deprecated: Optional[bool] = None
    allowEmptyValue: Optional[bool] = None
    style: Optional[str] = None
    explode: Optional[bool] = None
    allowReserved: Optional[bool] = None
    param_schema: Optional[Union[Reference, Schema]] = Field(default=None, alias="schema")
    example: Optional[Any] = None
    examples: Optional[Dict[str, Union[Example, Reference]]] = None
    content: Optional[Dict[str, MediaType]] = None

    model_config = {
        "extra": "allow"
    }

ParameterInType ⚓︎

Bases: str, Enum

The place Parameters can be put when calling an Endpoint

Source code in flask_openapi3/models/parameter_in_type.py
 7
 8
 9
10
11
12
13
class ParameterInType(str, Enum):
    """The place Parameters can be put when calling an Endpoint"""

    QUERY = "query"
    PATH = "path"
    HEADER = "header"
    COOKIE = "cookie"

PathItem ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#path-item-object

Source code in flask_openapi3/models/path_item.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class PathItem(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#path-item-object
    """
    ref: Optional[str] = Field(default=None, alias="$ref")
    summary: Optional[str] = None
    description: Optional[str] = None
    get: Optional["Operation"] = None
    put: Optional["Operation"] = None
    post: Optional["Operation"] = None
    delete: Optional["Operation"] = None
    options: Optional["Operation"] = None
    head: Optional["Operation"] = None
    patch: Optional["Operation"] = None
    trace: Optional["Operation"] = None
    servers: Optional[List[Server]] = None
    parameters: Optional[List[Union[Parameter, Reference]]] = None

    model_config = {
        "extra": "allow"
    }

Paths = Dict[str, PathItem] module-attribute ⚓︎

Reference ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#reference-object

Source code in flask_openapi3/models/reference.py
 7
 8
 9
10
11
12
13
14
15
16
class Reference(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#reference-object
    """

    ref: str = Field(..., alias="$ref")

    model_config = {
        "extra": "allow"
    }

RequestBody ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#request-body-object

Source code in flask_openapi3/models/request_body.py
11
12
13
14
15
16
17
18
19
20
21
22
class RequestBody(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#request-body-object
    """

    description: Optional[str] = None
    content: Dict[str, MediaType]
    required: Optional[bool] = True

    model_config = {
        "extra": "allow"
    }

Response ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#response-object

Source code in flask_openapi3/models/response.py
14
15
16
17
18
19
20
21
22
23
24
25
26
class Response(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#response-object
    """

    description: str
    headers: Optional[Dict[str, Union[Header, Reference]]] = None
    content: Optional[Dict[str, MediaType]] = None
    links: Optional[Dict[str, Union[Link, Reference]]] = None

    model_config = {
        "extra": "allow"
    }

Responses = Dict[str, Union[Response, Reference]] module-attribute ⚓︎

Schema ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#schema-object

Source code in flask_openapi3/models/schema.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class Schema(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#schema-object
    """
    ref: Optional[str] = Field(alias="$ref", default=None)
    title: Optional[str] = None
    multipleOf: Optional[float] = Field(default=None, gt=0.0)
    maximum: Optional[float] = None
    exclusiveMaximum: Optional[float] = None
    minimum: Optional[float] = None
    exclusiveMinimum: Optional[float] = None
    maxLength: Optional[int] = Field(default=None, ge=0)
    minLength: Optional[int] = Field(default=None, ge=0)
    pattern: Optional[str] = None
    maxItems: Optional[int] = Field(default=None, ge=0)
    minItems: Optional[int] = Field(default=None, ge=0)
    uniqueItems: Optional[bool] = None
    maxProperties: Optional[int] = Field(default=None, ge=0)
    minProperties: Optional[int] = Field(default=None, ge=0)
    required: Optional[List[str]] = Field(default=None)
    enum: Union[None, List[Any]] = Field(default=None)
    type: Optional[DataType] = Field(default=None)
    allOf: Optional[List[Union[Reference, "Schema"]]] = None
    oneOf: Optional[List[Union[Reference, "Schema"]]] = None
    anyOf: Optional[List[Union[Reference, "Schema"]]] = None
    schema_not: Optional[Union[Reference, "Schema"]] = Field(default=None, alias="not")
    items: Optional[Union[Reference, "Schema"]] = None
    properties: Optional[Dict[str, Union[Reference, "Schema"]]] = None
    additionalProperties: Optional[Union[bool, Reference, "Schema"]] = None
    description: Optional[str] = None
    schema_format: Optional[str] = Field(default=None, alias="format")
    default: Optional[Any] = None
    nullable: Optional[bool] = None
    discriminator: Optional[Discriminator] = None
    readOnly: Optional[bool] = None
    writeOnly: Optional[bool] = None
    xml: Optional[XML] = None
    externalDocs: Optional[ExternalDocumentation] = None
    example: Optional[Any] = None
    deprecated: Optional[bool] = None

SecurityRequirement = Dict[str, List[str]] module-attribute ⚓︎

SecurityScheme ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#security-scheme-object

Source code in flask_openapi3/models/security_scheme.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class SecurityScheme(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#security-scheme-object
    """

    type: str
    description: Optional[str] = None
    name: Optional[str] = None
    security_scheme_in: Optional[SecuritySchemeInType] = Field(default=None, alias="in")
    scheme: Optional[str] = None
    bearerFormat: Optional[str] = None
    flows: Optional[OAuthFlows] = None
    openIdConnectUrl: Optional[str] = None

    model_config = {
        "extra": "allow"
    }

Server ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#server-object

Source code in flask_openapi3/models/server.py
11
12
13
14
15
16
17
18
19
20
21
22
class Server(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#server-object
    """

    url: str
    description: Optional[str] = None
    variables: Optional[Dict[str, ServerVariable]] = None

    model_config = {
        "extra": "allow"
    }

ServerVariable ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#server-variable-object

Source code in flask_openapi3/models/server_variable.py
 9
10
11
12
13
14
15
16
17
18
19
20
class ServerVariable(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#server-variable-object
    """

    enum: List[str]
    default: str
    description: Optional[str] = None

    model_config = {
        "extra": "allow"
    }

StyleValues ⚓︎

Bases: str, Enum

Source code in flask_openapi3/models/style_values.py
 7
 8
 9
10
11
12
13
14
class StyleValues(str, Enum):
    matrix = "matrix"
    label = "label"
    form = "form"
    simple = "simple"
    spaceDelimited = "spaceDelimited"
    pipeDelimited = "pipeDelimited"
    deepObject = "deepObject"

Tag ⚓︎

Bases: BaseModel

https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tag-object

Source code in flask_openapi3/models/tag.py
 8
 9
10
11
12
13
14
15
16
17
18
19
class Tag(BaseModel):
    """
    https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tag-object
    """

    name: str
    description: Optional[str] = None
    externalDocs: Optional[ExternalDocumentation] = None

    model_config = {
        "extra": "allow"
    }

ValidationErrorModel ⚓︎

Bases: BaseModel

Source code in flask_openapi3/models/validation_error.py
 9
10
11
12
13
14
15
16
17
18
class ValidationErrorModel(BaseModel):
    # More information: https://docs.pydantic.dev/latest/usage/models/#error-handling
    loc: Optional[List[str]] = Field(None, title="Location", description="the error's location as a list. ")
    msg: Optional[str] = Field(None, title="Message", description="a computer-readable identifier of the error type.")
    type_: Optional[str] = Field(None, title="Error Type", description="a human readable explanation of the error.")
    ctx: Optional[Dict[str, Any]] = Field(
        None,
        title="Error context",
        description="an optional object which contains values required to render the error message."
    )

XML ⚓︎

Bases: BaseModel

https://spec.openapis.org/oas/v3.1.0#xml-object

Source code in flask_openapi3/models/xml.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
class XML(BaseModel):
    """
    https://spec.openapis.org/oas/v3.1.0#xml-object
    """

    name: Optional[str] = None
    namespace: Optional[str] = None
    prefix: Optional[str] = None
    attribute: bool = False
    wrapped: bool = False

    model_config = {
        "extra": "allow"
    }