Module aws_lambda_powertools.event_handler.openapi.models

Classes

class APIKey (**data: Any)

This class serves as a Pydantic proxy model to add OpenAPI extensions.

OpenAPI extensions are arbitrary fields, so we remove openapi_extensions when dumping and add only the provided value in the schema.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class APIKey(SecurityBase):
    type_: SecuritySchemeType = Field(default=SecuritySchemeType.apiKey, alias="type")
    in_: APIKeyIn = Field(alias="in")
    name: str

Ancestors

Class variables

var in_APIKeyIn
var name : str
var type_SecuritySchemeType
class APIKeyIn (*args, **kwds)

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

Color.RED

  • value lookup:

Color(1)

  • name lookup:

Color['RED']

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

Expand source code
class APIKeyIn(Enum):
    query = "query"
    header = "header"
    cookie = "cookie"

Ancestors

  • enum.Enum

Class variables

var cookie
var header
var query
class Components (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Components(BaseModel):
    schemas: Optional[Dict[str, Union[Schema, Reference]]] = 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, Reference]]] = None
    links: Optional[Dict[str, Union[Link, Reference]]] = None
    # Using Any for Specification Extensions
    callbacks: Optional[Dict[str, Union[Dict[str, PathItem], Reference, Any]]] = None
    pathItems: Optional[Dict[str, Union[PathItem, Reference]]] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var callbacks : Optional[Dict[str, Union[Dict[str, PathItem], Reference, Any]]]
var examples : Optional[Dict[str, Union[ExampleReference]]]
var headers : Optional[Dict[str, Union[HeaderReference]]]
var parameters : Optional[Dict[str, Union[ParameterReference]]]
var pathItems : Optional[Dict[str, Union[PathItemReference]]]
var requestBodies : Optional[Dict[str, Union[RequestBodyReference]]]
var responses : Optional[Dict[str, Union[ResponseReference]]]
var schemas : Optional[Dict[str, Union[SchemaReference]]]
var securitySchemes : Optional[Dict[str, Union[APIKeyHTTPBaseOAuth2OpenIdConnectHTTPBearerReference]]]
class Contact (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Contact(BaseModel):
    name: Optional[str] = None
    url: Optional[AnyUrl] = None
    email: Optional[str] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}
    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var email : Optional[str]
var name : Optional[str]
var url : Optional[pydantic.networks.AnyUrl]
class Discriminator (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Discriminator(BaseModel):
    propertyName: str
    mapping: Optional[Dict[str, str]] = None

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var mapping : Optional[Dict[str, str]]
var propertyName : str
class Encoding (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Encoding(BaseModel):
    contentType: Optional[str] = None
    headers: Optional[Dict[str, Union["Header", Reference]]] = None
    style: Optional[str] = None
    explode: Optional[bool] = None
    allowReserved: Optional[bool] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var allowReserved : Optional[bool]
var contentType : Optional[str]
var explode : Optional[bool]
var headers : Optional[Dict[str, Union[HeaderReference]]]
var style : Optional[str]
class Example (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Example(BaseModel):
    summary: Optional[str] = None
    description: Optional[str] = None
    value: Optional[Any] = None
    externalValue: Optional[AnyUrl] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var description : Optional[str]
var externalValue : Optional[pydantic.networks.AnyUrl]
var summary : Optional[str]
var value : Optional[Any]
class ExternalDocumentation (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class ExternalDocumentation(BaseModel):
    description: Optional[str] = None
    url: AnyUrl

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var description : Optional[str]
var url : pydantic.networks.AnyUrl
class HTTPBase (**data: Any)

This class serves as a Pydantic proxy model to add OpenAPI extensions.

OpenAPI extensions are arbitrary fields, so we remove openapi_extensions when dumping and add only the provided value in the schema.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class HTTPBase(SecurityBase):
    type_: SecuritySchemeType = Field(default=SecuritySchemeType.http, alias="type")
    scheme: str

Ancestors

Subclasses

Class variables

var scheme : str
var type_SecuritySchemeType
class HTTPBearer (**data: Any)

This class serves as a Pydantic proxy model to add OpenAPI extensions.

OpenAPI extensions are arbitrary fields, so we remove openapi_extensions when dumping and add only the provided value in the schema.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class HTTPBearer(HTTPBase):
    scheme: Literal["bearer"] = "bearer"
    bearerFormat: Optional[str] = None

Ancestors

Class variables

var bearerFormat : Optional[str]
var scheme : Literal['bearer']
class Header (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Header(ParameterBase):
    pass

Ancestors

  • ParameterBase
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
class Info (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Info(BaseModel):
    title: str
    description: Optional[str] = None
    termsOfService: Optional[str] = None
    contact: Optional[Contact] = None
    license: Optional[License] = None  # noqa: A003
    version: str

    if PYDANTIC_V2:
        summary: Optional[str] = None
        model_config = {"extra": "ignore"}

    else:

        class Config:
            extra = "ignore"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var contact : Optional[Contact]
var description : Optional[str]
var license : Optional[License]
var termsOfService : Optional[str]
var title : str
var version : str
class License (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class License(BaseModel):
    name: str
    identifier: Optional[str] = None
    url: Optional[AnyUrl] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var identifier : Optional[str]
var name : str
var url : Optional[pydantic.networks.AnyUrl]

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Link(BaseModel):
    operationRef: Optional[str] = None
    operationId: Optional[str] = None
    parameters: Optional[Dict[str, Union[Any, str]]] = None
    requestBody: Optional[Union[Any, str]] = None
    description: Optional[str] = None
    server: Optional[Server] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var description : Optional[str]
var operationId : Optional[str]
var operationRef : Optional[str]
var parameters : Optional[Dict[str, Union[Any, str]]]
var requestBody : Union[Any, str, ForwardRef(None)]
var server : Optional[Server]
class MediaType (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class MediaType(BaseModel):
    schema_: Optional[Union[Schema, Reference]] = Field(default=None, alias="schema")
    examples: Optional[Dict[str, Union[Example, Reference]]] = None
    encoding: Optional[Dict[str, Encoding]] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var encoding : Optional[Dict[str, Encoding]]
var examples : Optional[Dict[str, Union[ExampleReference]]]
var schema_ : Union[SchemaReference, ForwardRef(None)]
class OAuth2 (**data: Any)

This class serves as a Pydantic proxy model to add OpenAPI extensions.

OpenAPI extensions are arbitrary fields, so we remove openapi_extensions when dumping and add only the provided value in the schema.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class OAuth2(SecurityBase):
    type_: SecuritySchemeType = Field(default=SecuritySchemeType.oauth2, alias="type")
    flows: OAuthFlows

Ancestors

Class variables

var flowsOAuthFlows
var type_SecuritySchemeType
class OAuthFlow (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class OAuthFlow(BaseModel):
    refreshUrl: Optional[str] = None
    scopes: Dict[str, str] = {}

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Subclasses

Class variables

var Config
var refreshUrl : Optional[str]
var scopes : Dict[str, str]
class OAuthFlowAuthorizationCode (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class OAuthFlowAuthorizationCode(OAuthFlow):
    authorizationUrl: str
    tokenUrl: str

Ancestors

  • OAuthFlow
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var authorizationUrl : str
var tokenUrl : str
class OAuthFlowClientCredentials (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class OAuthFlowClientCredentials(OAuthFlow):
    tokenUrl: str

Ancestors

  • OAuthFlow
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var tokenUrl : str
class OAuthFlowImplicit (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class OAuthFlowImplicit(OAuthFlow):
    authorizationUrl: str

Ancestors

  • OAuthFlow
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var authorizationUrl : str
class OAuthFlowPassword (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class OAuthFlowPassword(OAuthFlow):
    tokenUrl: str

Ancestors

  • OAuthFlow
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var tokenUrl : str
class OAuthFlows (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class OAuthFlows(BaseModel):
    implicit: Optional[OAuthFlowImplicit] = None
    password: Optional[OAuthFlowPassword] = None
    clientCredentials: Optional[OAuthFlowClientCredentials] = None
    authorizationCode: Optional[OAuthFlowAuthorizationCode] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var authorizationCode : Optional[OAuthFlowAuthorizationCode]
var clientCredentials : Optional[OAuthFlowClientCredentials]
var implicit : Optional[OAuthFlowImplicit]
var password : Optional[OAuthFlowPassword]
class OpenAPI (**data: Any)

This class serves as a Pydantic proxy model to add OpenAPI extensions.

OpenAPI extensions are arbitrary fields, so we remove openapi_extensions when dumping and add only the provided value in the schema.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class OpenAPI(OpenAPIExtensions):
    openapi: str
    info: Info
    jsonSchemaDialect: Optional[str] = None
    servers: Optional[List[Server]] = None
    # Using Any for Specification Extensions
    paths: Optional[Dict[str, Union[PathItem, Any]]] = None
    webhooks: Optional[Dict[str, Union[PathItem, Reference]]] = None
    components: Optional[Components] = None
    security: Optional[List[Dict[str, List[str]]]] = None
    tags: Optional[List[Tag]] = None
    externalDocs: Optional[ExternalDocumentation] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

Class variables

var Config
var components : Optional[Components]
var externalDocs : Optional[ExternalDocumentation]
var infoInfo
var jsonSchemaDialect : Optional[str]
var openapi : str
var paths : Optional[Dict[str, Union[PathItem, Any]]]
var security : Optional[List[Dict[str, List[str]]]]
var servers : Optional[List[Server]]
var tags : Optional[List[Tag]]
var webhooks : Optional[Dict[str, Union[PathItemReference]]]
class OpenAPIExtensions (**data: Any)

This class serves as a Pydantic proxy model to add OpenAPI extensions.

OpenAPI extensions are arbitrary fields, so we remove openapi_extensions when dumping and add only the provided value in the schema.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class OpenAPIExtensions(BaseModel):
    """
    This class serves as a Pydantic proxy model to add OpenAPI extensions.

    OpenAPI extensions are arbitrary fields, so we remove openapi_extensions when dumping
    and add only the provided value in the schema.
    """

    openapi_extensions: Optional[Dict[str, Any]] = None

    # This rule is valid for Pydantic v1 and v2
    # If the 'openapi_extensions' field is present in the 'values' dictionary,
    # And if the extension starts with x- (must respect the RFC)
    # update the 'values' dictionary with the contents of 'openapi_extensions',
    # and then remove the 'openapi_extensions' field from the 'values' dictionary

    if PYDANTIC_V2:

        model_config = {"extra": "allow"}

        @parser_openapi_extension(mode="before")
        def serialize_openapi_extension_v2(self):
            if isinstance(self, dict) and self.get("openapi_extensions"):

                openapi_extension_value = self.get("openapi_extensions")

                for extension_key in openapi_extension_value:
                    if not str(extension_key).startswith("x-"):
                        raise SchemaValidationError("An OpenAPI extension key must start with x-")

                self.update(openapi_extension_value)
                self.pop("openapi_extensions", None)

            return self

    else:

        @parser_openapi_extension(pre=False, allow_reuse=True)
        def serialize_openapi_extension_v1(cls, values):
            openapi_extension_value = values.get("openapi_extensions")

            if openapi_extension_value:

                for extension_key in openapi_extension_value:
                    if not str(extension_key).startswith("x-"):
                        raise SchemaValidationError("An OpenAPI extension key must start with x-")

                values.update(values["openapi_extensions"])
                del values["openapi_extensions"]

            return values

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Subclasses

Class variables

var Config
var openapi_extensions : Optional[Dict[str, Any]]

Static methods

def serialize_openapi_extension_v1(values)
class OpenIdConnect (**data: Any)

This class serves as a Pydantic proxy model to add OpenAPI extensions.

OpenAPI extensions are arbitrary fields, so we remove openapi_extensions when dumping and add only the provided value in the schema.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class OpenIdConnect(SecurityBase):
    type_: SecuritySchemeType = Field(
        default=SecuritySchemeType.openIdConnect,
        alias="type",
    )
    openIdConnectUrl: str

Ancestors

Class variables

var openIdConnectUrl : str
var type_SecuritySchemeType
class Operation (**data: Any)

This class serves as a Pydantic proxy model to add OpenAPI extensions.

OpenAPI extensions are arbitrary fields, so we remove openapi_extensions when dumping and add only the provided value in the schema.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Operation(OpenAPIExtensions):
    tags: Optional[List[str]] = None
    summary: Optional[str] = None
    description: Optional[str] = None
    externalDocs: Optional[ExternalDocumentation] = None
    operationId: Optional[str] = None
    parameters: Optional[List[Union[Parameter, Reference]]] = None
    requestBody: Optional[Union[RequestBody, Reference]] = None
    # Using Any for Specification Extensions
    responses: Optional[Dict[int, Union[Response, Any]]] = None
    callbacks: Optional[Dict[str, Union[Dict[str, "PathItem"], Reference]]] = None
    deprecated: Optional[bool] = None
    security: Optional[List[Dict[str, List[str]]]] = None
    servers: Optional[List[Server]] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

Class variables

var Config
var callbacks : Optional[Dict[str, Union[Dict[str, PathItem], Reference]]]
var deprecated : Optional[bool]
var description : Optional[str]
var externalDocs : Optional[ExternalDocumentation]
var operationId : Optional[str]
var parameters : Optional[List[Union[ParameterReference]]]
var requestBody : Union[RequestBodyReference, ForwardRef(None)]
var responses : Optional[Dict[int, Union[Response, Any]]]
var security : Optional[List[Dict[str, List[str]]]]
var servers : Optional[List[Server]]
var summary : Optional[str]
var tags : Optional[List[str]]
class Parameter (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Parameter(ParameterBase):
    name: str
    in_: ParameterInType = Field(alias="in")

Ancestors

  • ParameterBase
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var in_ParameterInType
var name : str
class ParameterBase (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class ParameterBase(BaseModel):
    description: Optional[str] = None
    required: Optional[bool] = None
    deprecated: Optional[bool] = None
    # Serialization rules for simple scenarios
    style: Optional[str] = None
    explode: Optional[bool] = None
    allowReserved: Optional[bool] = None
    schema_: Optional[Union[Schema, Reference]] = Field(default=None, alias="schema")
    examples: Optional[Dict[str, Union[Example, Reference]]] = None
    # Serialization rules for more complex scenarios
    content: Optional[Dict[str, MediaType]] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Subclasses

Class variables

var Config
var allowReserved : Optional[bool]
var content : Optional[Dict[str, MediaType]]
var deprecated : Optional[bool]
var description : Optional[str]
var examples : Optional[Dict[str, Union[ExampleReference]]]
var explode : Optional[bool]
var required : Optional[bool]
var schema_ : Union[SchemaReference, ForwardRef(None)]
var style : Optional[str]
class ParameterInType (*args, **kwds)

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

Color.RED

  • value lookup:

Color(1)

  • name lookup:

Color['RED']

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

Expand source code
class ParameterInType(Enum):
    query = "query"
    header = "header"
    path = "path"
    cookie = "cookie"

Ancestors

  • enum.Enum

Class variables

var cookie
var header
var path
var query
class PathItem (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class PathItem(BaseModel):
    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

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var delete : Optional[Operation]
var description : Optional[str]
var get : Optional[Operation]
var head : Optional[Operation]
var options : Optional[Operation]
var parameters : Optional[List[Union[ParameterReference]]]
var patch : Optional[Operation]
var post : Optional[Operation]
var put : Optional[Operation]
var ref : Optional[str]
var servers : Optional[List[Server]]
var summary : Optional[str]
var trace : Optional[Operation]
class Reference (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Reference(BaseModel):
    ref: str = Field(alias="$ref")

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var ref : str
class RequestBody (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class RequestBody(BaseModel):
    description: Optional[str] = None
    content: Dict[str, MediaType]
    required: Optional[bool] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var content : Dict[str, MediaType]
var description : Optional[str]
var required : Optional[bool]
class Response (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Response(BaseModel):
    description: str
    headers: Optional[Dict[str, Union[Header, Reference]]] = None
    content: Optional[Dict[str, MediaType]] = None
    links: Optional[Dict[str, Union[Link, Reference]]] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var content : Optional[Dict[str, MediaType]]
var description : str
var headers : Optional[Dict[str, Union[HeaderReference]]]
class Schema (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Schema(BaseModel):
    # Ref: JSON Schema 2020-12: https://json-schema.org/draft/2020-12/json-schema-core.html#name-the-json-schema-core-vocabu
    # Core Vocabulary
    schema_: Optional[str] = Field(default=None, alias="$schema")
    vocabulary: Optional[str] = Field(default=None, alias="$vocabulary")
    id: Optional[str] = Field(default=None, alias="$id")  # noqa: A003
    anchor: Optional[str] = Field(default=None, alias="$anchor")
    dynamicAnchor: Optional[str] = Field(default=None, alias="$dynamicAnchor")
    ref: Optional[str] = Field(default=None, alias="$ref")
    dynamicRef: Optional[str] = Field(default=None, alias="$dynamicRef")
    defs: Optional[Dict[str, "SchemaOrBool"]] = Field(default=None, alias="$defs")
    comment: Optional[str] = Field(default=None, alias="$comment")
    # Ref: JSON Schema 2020-12: https://json-schema.org/draft/2020-12/json-schema-core.html#name-a-vocabulary-for-applying-s
    # A Vocabulary for Applying Subschemas
    allOf: Optional[List["SchemaOrBool"]] = None
    anyOf: Optional[List["SchemaOrBool"]] = None
    oneOf: Optional[List["SchemaOrBool"]] = None
    not_: Optional["SchemaOrBool"] = Field(default=None, alias="not")
    if_: Optional["SchemaOrBool"] = Field(default=None, alias="if")
    then: Optional["SchemaOrBool"] = None
    else_: Optional["SchemaOrBool"] = Field(default=None, alias="else")
    dependentSchemas: Optional[Dict[str, "SchemaOrBool"]] = None
    prefixItems: Optional[List["SchemaOrBool"]] = None
    # MAINTENANCE: uncomment and remove below when deprecating Pydantic v1
    # MAINTENANCE: It generates a list of schemas for tuples, before prefixItems was available
    # MAINTENANCE: items: Optional["SchemaOrBool"] = None
    items: Optional[Union["SchemaOrBool", List["SchemaOrBool"]]] = None
    contains: Optional["SchemaOrBool"] = None
    properties: Optional[Dict[str, "SchemaOrBool"]] = None
    patternProperties: Optional[Dict[str, "SchemaOrBool"]] = None
    additionalProperties: Optional["SchemaOrBool"] = None
    propertyNames: Optional["SchemaOrBool"] = None
    unevaluatedItems: Optional["SchemaOrBool"] = None
    unevaluatedProperties: Optional["SchemaOrBool"] = None
    # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-a-vocabulary-for-structural
    # A Vocabulary for Structural Validation
    type: Optional[str] = None  # noqa: A003
    enum: Optional[List[Any]] = None
    const: Optional[Any] = None
    multipleOf: Optional[float] = Field(default=None, gt=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
    maxContains: Optional[int] = Field(default=None, ge=0)
    minContains: Optional[int] = Field(default=None, ge=0)
    maxProperties: Optional[int] = Field(default=None, ge=0)
    minProperties: Optional[int] = Field(default=None, ge=0)
    required: Optional[List[str]] = None
    dependentRequired: Optional[Dict[str, Set[str]]] = None
    # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-vocabularies-for-semantic-c
    # Vocabularies for Semantic Content With "format"
    format: Optional[str] = None  # noqa: A003
    # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-a-vocabulary-for-the-conten
    # A Vocabulary for the Contents of String-Encoded Data
    contentEncoding: Optional[str] = None
    contentMediaType: Optional[str] = None
    contentSchema: Optional["SchemaOrBool"] = None
    # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-a-vocabulary-for-basic-meta
    # A Vocabulary for Basic Meta-Data Annotations
    title: Optional[str] = None
    description: Optional[str] = None
    default: Optional[Any] = None
    deprecated: Optional[bool] = None
    readOnly: Optional[bool] = None
    writeOnly: Optional[bool] = None
    examples: Optional[List["Example"]] = None
    # Ref: OpenAPI 3.0.0: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#schema-object
    # Schema Object
    discriminator: Optional[Discriminator] = None
    xml: Optional[XML] = None
    externalDocs: Optional[ExternalDocumentation] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var additionalProperties : Union[Schema, bool, ForwardRef(None)]
var allOf : Optional[List[Union[Schema, bool]]]
var anchor : Optional[str]
var anyOf : Optional[List[Union[Schema, bool]]]
var comment : Optional[str]
var const : Optional[Any]
var contains : Union[Schema, bool, ForwardRef(None)]
var contentEncoding : Optional[str]
var contentMediaType : Optional[str]
var contentSchema : Union[Schema, bool, ForwardRef(None)]
var default : Optional[Any]
var defs : Optional[Dict[str, Union[Schema, bool]]]
var dependentRequired : Optional[Dict[str, Set[str]]]
var dependentSchemas : Optional[Dict[str, Union[Schema, bool]]]
var deprecated : Optional[bool]
var description : Optional[str]
var discriminator : Optional[Discriminator]
var dynamicAnchor : Optional[str]
var dynamicRef : Optional[str]
var else_ : Union[Schema, bool, ForwardRef(None)]
var enum : Optional[List[Any]]
var examples : Optional[List[Example]]
var exclusiveMaximum : Optional[float]
var exclusiveMinimum : Optional[float]
var externalDocs : Optional[ExternalDocumentation]
var format : Optional[str]
var id : Optional[str]
var if_ : Union[Schema, bool, ForwardRef(None)]
var items : Union[Schema, bool, List[Union[Schema, bool]], ForwardRef(None)]
var maxContains : Optional[int]
var maxItems : Optional[int]
var maxLength : Optional[int]
var maxProperties : Optional[int]
var maximum : Optional[float]
var minContains : Optional[int]
var minItems : Optional[int]
var minLength : Optional[int]
var minProperties : Optional[int]
var minimum : Optional[float]
var multipleOf : Optional[float]
var not_ : Union[Schema, bool, ForwardRef(None)]
var oneOf : Optional[List[Union[Schema, bool]]]
var pattern : Optional[str]
var patternProperties : Optional[Dict[str, Union[Schema, bool]]]
var prefixItems : Optional[List[Union[Schema, bool]]]
var properties : Optional[Dict[str, Union[Schema, bool]]]
var propertyNames : Union[Schema, bool, ForwardRef(None)]
var readOnly : Optional[bool]
var ref : Optional[str]
var required : Optional[List[str]]
var schema_ : Optional[str]
var then : Union[Schema, bool, ForwardRef(None)]
var title : Optional[str]
var type : Optional[str]
var unevaluatedItems : Union[Schema, bool, ForwardRef(None)]
var unevaluatedProperties : Union[Schema, bool, ForwardRef(None)]
var uniqueItems : Optional[bool]
var vocabulary : Optional[str]
var writeOnly : Optional[bool]
var xml : Optional[XML]
class SecurityBase (**data: Any)

This class serves as a Pydantic proxy model to add OpenAPI extensions.

OpenAPI extensions are arbitrary fields, so we remove openapi_extensions when dumping and add only the provided value in the schema.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class SecurityBase(OpenAPIExtensions):
    type_: SecuritySchemeType = Field(alias="type")
    description: Optional[str] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow", "populate_by_name": True}  # type: ignore

    else:

        class Config:
            extra = "allow"
            allow_population_by_field_name = True

Ancestors

Subclasses

Class variables

var Config
var description : Optional[str]
var type_SecuritySchemeType
class SecuritySchemeType (*args, **kwds)

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

Color.RED

  • value lookup:

Color(1)

  • name lookup:

Color['RED']

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

Expand source code
class SecuritySchemeType(Enum):
    apiKey = "apiKey"
    http = "http"
    oauth2 = "oauth2"
    openIdConnect = "openIdConnect"

Ancestors

  • enum.Enum

Class variables

var apiKey
var http
var oauth2
var openIdConnect
class Server (**data: Any)

This class serves as a Pydantic proxy model to add OpenAPI extensions.

OpenAPI extensions are arbitrary fields, so we remove openapi_extensions when dumping and add only the provided value in the schema.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Server(OpenAPIExtensions):
    url: Union[AnyUrl, str]
    description: Optional[str] = None
    variables: Optional[Dict[str, ServerVariable]] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

Class variables

var Config
var description : Optional[str]
var url : Union[pydantic.networks.AnyUrl, str]
var variables : Optional[Dict[str, ServerVariable]]
class ServerVariable (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class ServerVariable(BaseModel):
    enum: Annotated[Optional[List[str]], Field(min_length=1)] = None
    default: str
    description: Optional[str] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var default : str
var description : Optional[str]
var enum : Optional[List[str]]
class Tag (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Tag(BaseModel):
    name: str
    description: Optional[str] = None
    externalDocs: Optional[ExternalDocumentation] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var description : Optional[str]
var externalDocs : Optional[ExternalDocumentation]
var name : str
class XML (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class XML(BaseModel):
    name: Optional[str] = None
    namespace: Optional[str] = None
    prefix: Optional[str] = None
    attribute: Optional[bool] = None
    wrapped: Optional[bool] = None

    if PYDANTIC_V2:
        model_config = {"extra": "allow"}

    else:

        class Config:
            extra = "allow"

Ancestors

  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Config
var attribute : Optional[bool]
var name : Optional[str]
var namespace : Optional[str]
var prefix : Optional[str]
var wrapped : Optional[bool]