跳转至

# Models

## `APISpec`

Bases: `BaseModel`

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

Source code in `flask_openapi3/models/__init__.py`

    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66

    class APISpec(BaseModel):
        """https://spec.openapis.org/oas/v3.1.0#openapi-object"""

        openapi: str
        info: Info
        servers: list[Server] | None = None
        paths: Paths
        components: Components | None = None
        security: list[SecurityRequirement] | None = None
        tags: list[Tag] | None = None
        externalDocs: ExternalDocumentation | None = None
        webhooks: dict[str, PathItem | Reference] | None = 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`

    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82

    class OAuthConfig(BaseModel):
        """
        https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/oauth2.md#oauth-20-configuration
        """

        clientId: str | None = None
        clientSecret: str | None = None
        realm: str | None = None
        appName: str | None = None
        scopeSeparator: str | None = None
        scopes: str | None = None
        additionalQueryStringParams: dict[str, str] | None = None
        useBasicAuthenticationWithAccessCodeGrant: bool | None = False
        usePkceWithAuthorizationCodeGrant: bool | None = 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

    class Components(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#components-object
        """

        schemas: dict[str, Reference | Schema] | None = Field(None)
        responses: dict[str, Response | Reference] | None = None
        parameters: dict[str, Parameter | Reference] | None = None
        examples: dict[str, Example | Reference] | None = None
        requestBodies: dict[str, RequestBody | Reference] | None = None
        headers: dict[str, Header | Reference] | None = None
        securitySchemes: dict[str, SecurityScheme | dict[str, Any]] | None = None
        links: dict[str, Link | Reference] | None = None
        callbacks: dict[str, Callback | Reference] | None = None
        pathItems: dict[str, PathItem | Reference] | None = 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`

     8
     9
    10
    11
    12
    13
    14
    15
    16
    17

    class Contact(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#contact-object
        """

        name: str | None = None
        url: str | None = None
        email: str | None = 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`

     8
     9
    10
    11
    12
    13
    14
    15
    16

    class Discriminator(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#discriminator-object
        """

        propertyName: str
        mapping: dict[str, str] | None = 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

    class Encoding(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#encoding-object
        """

        contentType: str | None = None
        headers: dict[str, Union[Header, Reference]] | None = None
        style: str | None = None
        explode: bool | None = 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

    class Example(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#example-object
        """

        summary: str | None = None
        description: str | None = None
        value: Any | None = None
        externalValue: str | None = 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`

     8
     9
    10
    11
    12
    13
    14
    15
    16

    class ExternalDocumentation(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#external-documentation-object
        """

        description: str | None = 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, *_args: Any, **_kwargs: Any) -> JsonSchemaValue:
            field_schema = {"format": "binary", "type": "string"}
            return field_schema

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

        @classmethod
        def validate(cls, value: _FileStorage, *_args: Any, **_kwargs: Any) -> _FileStorage:
            return value

## `Header`

Bases: `Parameter`

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

Source code in `flask_openapi3/models/header.py`

     9
    10
    11
    12
    13
    14
    15
    16
    17

    class Header(Parameter):
        """
        https://spec.openapis.org/oas/v3.1.0#header-object
        """

        name: str | None = None  # type:ignore
        param_in: ParameterInType | None = 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`

    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24

    class Info(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#info-object
        """

        title: str
        summary: str | None = None
        description: str | None = None
        termsOfService: str | None = None
        contact: Contact | None = None
        license: License | None = 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`

     8
     9
    10
    11
    12
    13
    14
    15
    16
    17

    class License(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#license-object
        """

        name: str
        identifier: str | None = None
        url: str | None = None

        model_config = {"extra": "allow"}

## `Link`

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

    class Link(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#link-object
        """

        operationRef: str | None = None
        operationId: str | None = None
        parameters: dict[str, Any] | None = None
        requestBody: Any | None = None
        description: str | None = None
        server: Server | None = 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

    class MediaType(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#media-type-object
        """

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

        model_config = {"extra": "allow", "populate_by_name": True}

## `OAuthFlow`

Bases: `BaseModel`

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

Source code in `flask_openapi3/models/oauth_flow.py`

     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18

    class OAuthFlow(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#oauth-flow-object
        """

        authorizationUrl: str | None = None
        tokenUrl: str | None = None
        refreshUrl: str | None = 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`

    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20

    class OAuthFlows(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#oauth-flows-object
        """

        implicit: OAuthFlow | None = None
        password: OAuthFlow | None = None
        clientCredentials: OAuthFlow | None = None
        authorizationCode: OAuthFlow | None = 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`

    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36

    class Operation(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#operation-object
        """

        tags: list[str] | None = None
        summary: str | None = None
        description: str | None = None
        externalDocs: ExternalDocumentation | None = None
        operationId: str | None = None
        parameters: list[Parameter] | None = None
        requestBody: RequestBody | Reference | None = None
        responses: dict[str, Response] | None = None
        callbacks: dict[str, Callback] | None = None

        deprecated: bool | None = False
        security: list[SecurityRequirement] | None = None
        servers: list[Server] | None = 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

    class Parameter(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#parameter-object
        """

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

        model_config = {"extra": "allow", "populate_by_name": True}

## `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

    class PathItem(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#path-item-object
        """

        ref: str | None = Field(default=None, alias="$ref")
        summary: str | None = None
        description: str | None = 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: list[Server] | None = None
        parameters: list[Parameter | Reference] | None = None

        model_config = {"extra": "allow", "populate_by_name": True}

## `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

    class Reference(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#reference-object
        """

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

        model_config = {"extra": "allow", "populate_by_name": True}

## `RequestBody`

Bases: `BaseModel`

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

Source code in `flask_openapi3/models/request_body.py`

    10
    11
    12
    13
    14
    15
    16
    17
    18
    19

    class RequestBody(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#request-body-object
        """

        description: str | None = None
        content: dict[str, MediaType]
        required: bool | None = 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`

    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23

    class Response(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#response-object
        """

        description: str
        headers: dict[str, Header | Reference] | None = None
        content: dict[str, MediaType] | None = None
        links: dict[str, Link | Reference] | None = None

        model_config = {"extra": "allow"}

## `Responses = dict[str, 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
    55
    56
    57
    58
    59

    class Schema(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#schema-object
        """

        ref: str | None = Field(alias="$ref", default=None)
        title: str | None = None
        multipleOf: float | None = Field(default=None, gt=0.0)
        maximum: int | float | None = None
        exclusiveMaximum: float | None = None
        minimum: float | None = None
        exclusiveMinimum: float | None = None
        maxLength: int | None = Field(default=None, ge=0)
        minLength: int | None = Field(default=None, ge=0)
        pattern: str | None = None
        maxItems: int | None = Field(default=None, ge=0)
        minItems: int | None = Field(default=None, ge=0)
        uniqueItems: bool | None = None
        maxProperties: int | None = Field(default=None, ge=0)
        minProperties: int | None = Field(default=None, ge=0)
        required: list[str] | None = Field(default=None)
        enum: None | list[Any] = Field(default=None)
        type: DataType | None = Field(default=None)
        allOf: list[Union[Reference, "Schema"]] | None = None
        oneOf: list[Union[Reference, "Schema"]] | None = None
        anyOf: list[Union[Reference, "Schema"]] | None = None
        schema_not: Union[Reference, "Schema"] | None = Field(default=None, alias="not")
        items: Union[Reference, "Schema"] | None = None
        properties: dict[str, Union[Reference, "Schema"]] | None = None
        prefixItems: list[Union[Reference, "Schema"]] | None = None
        additionalProperties: Union[bool, Reference, "Schema"] | None = None
        description: str | None = None
        schema_format: str | None = Field(default=None, alias="format")
        default: Any | None = None
        nullable: bool | None = None
        discriminator: Discriminator | None = None
        readOnly: bool | None = None
        writeOnly: bool | None = None
        xml: XML | None = None
        externalDocs: ExternalDocumentation | None = None
        example: Any | None = None
        deprecated: bool | None = None
        const: Any | None = None

        model_config = {"populate_by_name": True}

## `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`

    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25

    class SecurityScheme(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#security-scheme-object
        """

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

        model_config = {"extra": "allow", "populate_by_name": True}

## `Server`

Bases: `BaseModel`

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

Source code in `flask_openapi3/models/server.py`

    10
    11
    12
    13
    14
    15
    16
    17
    18
    19

    class Server(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#server-object
        """

        url: str
        description: str | None = None
        variables: dict[str, ServerVariable] | None = 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`

     8
     9
    10
    11
    12
    13
    14
    15
    16
    17

    class ServerVariable(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#server-variable-object
        """

        enum: list[str] | None = Field(None, min_length=1)
        default: str
        description: str | None = 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`

     6
     7
     8
     9
    10
    11
    12
    13
    14
    15

    class Tag(BaseModel):
        """
        https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tag-object
        """

        name: str
        description: str | None = None
        externalDocs: ExternalDocumentation | None = 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
    19
    20

    class ValidationErrorModel(BaseModel):
        # More information: https://docs.pydantic.dev/latest/concepts/models/#error-handling
        type: str = Field(..., title="Error Type", description="A computer-readable identifier of the error type.")
        loc: list[Any] = Field(..., title="Location", description="The error's location as a list.")
        msg: str = Field(..., title="Message", description="A human readable explanation of the error.")
        input: Any = Field(..., title="Input", description="The input provided for validation.")
        url: str | None = Field(None, title="URL", description="The URL to further information about the error.")
        ctx: dict[str, Any] | None = 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`

     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19

    class XML(BaseModel):
        """
        https://spec.openapis.org/oas/v3.1.0#xml-object
        """

        name: str | None = None
        namespace: str | None = None
        prefix: str | None = None
        attribute: bool = False
        wrapped: bool = False

        model_config = {"extra": "allow"}