OpenAPI models

OpenAPI Pydantic models used to generate and validate the generated OpenAPI.

fastapi.openapi.models

SchemaOrBool module-attribute

  1. SchemaOrBool = Union[Schema, bool]

SecurityScheme module-attribute

  1. SecurityScheme = Union[
  2. APIKey, HTTPBase, OAuth2, OpenIdConnect, HTTPBearer
  3. ]

EmailStr

Bases: str

validate classmethod

  1. validate(v)
PARAMETERDESCRIPTION
v

TYPE: Any

Source code in fastapi/openapi/models.py

  1. 29
  2. 30
  3. 31
  4. 32
  5. 33
  6. 34
  7. 35
  1. @classmethod
  2. def validate(cls, v: Any) -> str:
  3. logger.warning(
  4. email-validator not installed, email fields will be treated as str.\n
  5. To install, run: pip install email-validator
  6. )
  7. return str(v)

Contact

Bases: BaseModel

name class-attribute instance-attribute

  1. name = None

url class-attribute instance-attribute

  1. url = None

email class-attribute instance-attribute

  1. email = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

License

Bases: BaseModel

name instance-attribute

  1. name

identifier class-attribute instance-attribute

  1. identifier = None

url class-attribute instance-attribute

  1. url = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

Info

Bases: BaseModel

title instance-attribute

  1. title

summary class-attribute instance-attribute

  1. summary = None

description class-attribute instance-attribute

  1. description = None

termsOfService class-attribute instance-attribute

  1. termsOfService = None

contact class-attribute instance-attribute

  1. contact = None

license class-attribute instance-attribute

  1. license = None

version instance-attribute

  1. version

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

ServerVariable

Bases: BaseModel

enum class-attribute instance-attribute

  1. enum = None

default instance-attribute

  1. default

description class-attribute instance-attribute

  1. description = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

Server

Bases: BaseModel

url instance-attribute

  1. url

description class-attribute instance-attribute

  1. description = None

variables class-attribute instance-attribute

  1. variables = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

Reference

Bases: BaseModel

ref class-attribute instance-attribute

  1. ref = Field(alias='$ref')

Discriminator

Bases: BaseModel

propertyName instance-attribute

  1. propertyName

mapping class-attribute instance-attribute

  1. mapping = None

XML

Bases: BaseModel

name class-attribute instance-attribute

  1. name = None

namespace class-attribute instance-attribute

  1. namespace = None

prefix class-attribute instance-attribute

  1. prefix = None

attribute class-attribute instance-attribute

  1. attribute = None

wrapped class-attribute instance-attribute

  1. wrapped = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

ExternalDocumentation

Bases: BaseModel

description class-attribute instance-attribute

  1. description = None

url instance-attribute

  1. url

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

Schema

Bases: BaseModel

schema_ class-attribute instance-attribute

  1. schema_ = Field(default=None, alias='$schema')

vocabulary class-attribute instance-attribute

  1. vocabulary = Field(default=None, alias='$vocabulary')

id class-attribute instance-attribute

  1. id = Field(default=None, alias='$id')

anchor class-attribute instance-attribute

  1. anchor = Field(default=None, alias='$anchor')

dynamicAnchor class-attribute instance-attribute

  1. dynamicAnchor = Field(default=None, alias='$dynamicAnchor')

ref class-attribute instance-attribute

  1. ref = Field(default=None, alias='$ref')

dynamicRef class-attribute instance-attribute

  1. dynamicRef = Field(default=None, alias='$dynamicRef')

defs class-attribute instance-attribute

  1. defs = Field(default=None, alias='$defs')

comment class-attribute instance-attribute

  1. comment = Field(default=None, alias='$comment')

allOf class-attribute instance-attribute

  1. allOf = None

anyOf class-attribute instance-attribute

  1. anyOf = None

oneOf class-attribute instance-attribute

  1. oneOf = None

not_ class-attribute instance-attribute

  1. not_ = Field(default=None, alias='not')

if_ class-attribute instance-attribute

  1. if_ = Field(default=None, alias='if')

then class-attribute instance-attribute

  1. then = None

else_ class-attribute instance-attribute

  1. else_ = Field(default=None, alias='else')

dependentSchemas class-attribute instance-attribute

  1. dependentSchemas = None

prefixItems class-attribute instance-attribute

  1. prefixItems = None

items class-attribute instance-attribute

  1. items = None

contains class-attribute instance-attribute

  1. contains = None

properties class-attribute instance-attribute

  1. properties = None

patternProperties class-attribute instance-attribute

  1. patternProperties = None

additionalProperties class-attribute instance-attribute

  1. additionalProperties = None

propertyNames class-attribute instance-attribute

  1. propertyNames = None

unevaluatedItems class-attribute instance-attribute

  1. unevaluatedItems = None

unevaluatedProperties class-attribute instance-attribute

  1. unevaluatedProperties = None

type class-attribute instance-attribute

  1. type = None

enum class-attribute instance-attribute

  1. enum = None

const class-attribute instance-attribute

  1. const = None

multipleOf class-attribute instance-attribute

  1. multipleOf = Field(default=None, gt=0)

maximum class-attribute instance-attribute

  1. maximum = None

exclusiveMaximum class-attribute instance-attribute

  1. exclusiveMaximum = None

minimum class-attribute instance-attribute

  1. minimum = None

exclusiveMinimum class-attribute instance-attribute

  1. exclusiveMinimum = None

maxLength class-attribute instance-attribute

  1. maxLength = Field(default=None, ge=0)

minLength class-attribute instance-attribute

  1. minLength = Field(default=None, ge=0)

pattern class-attribute instance-attribute

  1. pattern = None

maxItems class-attribute instance-attribute

  1. maxItems = Field(default=None, ge=0)

minItems class-attribute instance-attribute

  1. minItems = Field(default=None, ge=0)

uniqueItems class-attribute instance-attribute

  1. uniqueItems = None

maxContains class-attribute instance-attribute

  1. maxContains = Field(default=None, ge=0)

minContains class-attribute instance-attribute

  1. minContains = Field(default=None, ge=0)

maxProperties class-attribute instance-attribute

  1. maxProperties = Field(default=None, ge=0)

minProperties class-attribute instance-attribute

  1. minProperties = Field(default=None, ge=0)

required class-attribute instance-attribute

  1. required = None

dependentRequired class-attribute instance-attribute

  1. dependentRequired = None

format class-attribute instance-attribute

  1. format = None

contentEncoding class-attribute instance-attribute

  1. contentEncoding = None

contentMediaType class-attribute instance-attribute

  1. contentMediaType = None

contentSchema class-attribute instance-attribute

  1. contentSchema = None

title class-attribute instance-attribute

  1. title = None

description class-attribute instance-attribute

  1. description = None

default class-attribute instance-attribute

  1. default = None

deprecated class-attribute instance-attribute

  1. deprecated = None

readOnly class-attribute instance-attribute

  1. readOnly = None

writeOnly class-attribute instance-attribute

  1. writeOnly = None

examples class-attribute instance-attribute

  1. examples = None

discriminator class-attribute instance-attribute

  1. discriminator = None

xml class-attribute instance-attribute

  1. xml = None

externalDocs class-attribute instance-attribute

  1. externalDocs = None

example class-attribute instance-attribute

  1. example = None

Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, although still supported. Use examples instead.

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

Example

Bases: TypedDict

summary instance-attribute

  1. summary

description instance-attribute

  1. description

value instance-attribute

  1. value

externalValue instance-attribute

  1. externalValue

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

ParameterInType

Bases: Enum

query class-attribute instance-attribute

  1. query = 'query'

header class-attribute instance-attribute

  1. header = 'header'

path class-attribute instance-attribute

  1. path = 'path'
  1. cookie = 'cookie'

Encoding

Bases: BaseModel

contentType class-attribute instance-attribute

  1. contentType = None

headers class-attribute instance-attribute

  1. headers = None

style class-attribute instance-attribute

  1. style = None

explode class-attribute instance-attribute

  1. explode = None

allowReserved class-attribute instance-attribute

  1. allowReserved = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

MediaType

Bases: BaseModel

schema_ class-attribute instance-attribute

  1. schema_ = Field(default=None, alias='schema')

example class-attribute instance-attribute

  1. example = None

examples class-attribute instance-attribute

  1. examples = None

encoding class-attribute instance-attribute

  1. encoding = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

ParameterBase

Bases: BaseModel

description class-attribute instance-attribute

  1. description = None

required class-attribute instance-attribute

  1. required = None

deprecated class-attribute instance-attribute

  1. deprecated = None

style class-attribute instance-attribute

  1. style = None

explode class-attribute instance-attribute

  1. explode = None

allowReserved class-attribute instance-attribute

  1. allowReserved = None

schema_ class-attribute instance-attribute

  1. schema_ = Field(default=None, alias='schema')

example class-attribute instance-attribute

  1. example = None

examples class-attribute instance-attribute

  1. examples = None

content class-attribute instance-attribute

  1. content = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

Parameter

Bases: [ParameterBase](#fastapi.openapi.models.ParameterBase "fastapi.openapi.models.ParameterBase")

description class-attribute instance-attribute

  1. description = None

required class-attribute instance-attribute

  1. required = None

deprecated class-attribute instance-attribute

  1. deprecated = None

style class-attribute instance-attribute

  1. style = None

explode class-attribute instance-attribute

  1. explode = None

allowReserved class-attribute instance-attribute

  1. allowReserved = None

schema_ class-attribute instance-attribute

  1. schema_ = Field(default=None, alias='schema')

example class-attribute instance-attribute

  1. example = None

examples class-attribute instance-attribute

  1. examples = None

content class-attribute instance-attribute

  1. content = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

name instance-attribute

  1. name

in_ class-attribute instance-attribute

  1. in_ = Field(alias='in')

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

Header

Bases: [ParameterBase](#fastapi.openapi.models.ParameterBase "fastapi.openapi.models.ParameterBase")

RequestBody

Bases: BaseModel

description class-attribute instance-attribute

  1. description = None

content instance-attribute

  1. content

required class-attribute instance-attribute

  1. required = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

Bases: BaseModel

operationRef class-attribute instance-attribute

  1. operationRef = None

operationId class-attribute instance-attribute

  1. operationId = None

parameters class-attribute instance-attribute

  1. parameters = None

requestBody class-attribute instance-attribute

  1. requestBody = None

description class-attribute instance-attribute

  1. description = None

server class-attribute instance-attribute

  1. server = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

Response

Bases: BaseModel

description instance-attribute

  1. description

headers class-attribute instance-attribute

  1. headers = None

content class-attribute instance-attribute

  1. content = None
  1. links = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

Operation

Bases: BaseModel

tags class-attribute instance-attribute

  1. tags = None

summary class-attribute instance-attribute

  1. summary = None

description class-attribute instance-attribute

  1. description = None

externalDocs class-attribute instance-attribute

  1. externalDocs = None

operationId class-attribute instance-attribute

  1. operationId = None

parameters class-attribute instance-attribute

  1. parameters = None

requestBody class-attribute instance-attribute

  1. requestBody = None

responses class-attribute instance-attribute

  1. responses = None

callbacks class-attribute instance-attribute

  1. callbacks = None

deprecated class-attribute instance-attribute

  1. deprecated = None

security class-attribute instance-attribute

  1. security = None

servers class-attribute instance-attribute

  1. servers = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

PathItem

Bases: BaseModel

ref class-attribute instance-attribute

  1. ref = Field(default=None, alias='$ref')

summary class-attribute instance-attribute

  1. summary = None

description class-attribute instance-attribute

  1. description = None

get class-attribute instance-attribute

  1. get = None

put class-attribute instance-attribute

  1. put = None

post class-attribute instance-attribute

  1. post = None

delete class-attribute instance-attribute

  1. delete = None

options class-attribute instance-attribute

  1. options = None

head class-attribute instance-attribute

  1. head = None

patch class-attribute instance-attribute

  1. patch = None

trace class-attribute instance-attribute

  1. trace = None

servers class-attribute instance-attribute

  1. servers = None

parameters class-attribute instance-attribute

  1. parameters = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

SecuritySchemeType

Bases: Enum

apiKey class-attribute instance-attribute

  1. apiKey = 'apiKey'

http class-attribute instance-attribute

  1. http = 'http'

oauth2 class-attribute instance-attribute

  1. oauth2 = 'oauth2'

openIdConnect class-attribute instance-attribute

  1. openIdConnect = 'openIdConnect'

SecurityBase

Bases: BaseModel

type_ class-attribute instance-attribute

  1. type_ = Field(alias='type')

description class-attribute instance-attribute

  1. description = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

APIKeyIn

Bases: Enum

query class-attribute instance-attribute

  1. query = 'query'

header class-attribute instance-attribute

  1. header = 'header'
  1. cookie = 'cookie'

APIKey

Bases: [SecurityBase](#fastapi.openapi.models.SecurityBase "fastapi.openapi.models.SecurityBase")

description class-attribute instance-attribute

  1. description = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

type_ class-attribute instance-attribute

  1. type_ = Field(default=apiKey, alias='type')

in_ class-attribute instance-attribute

  1. in_ = Field(alias='in')

name instance-attribute

  1. name

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

HTTPBase

Bases: [SecurityBase](#fastapi.openapi.models.SecurityBase "fastapi.openapi.models.SecurityBase")

description class-attribute instance-attribute

  1. description = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

type_ class-attribute instance-attribute

  1. type_ = Field(default=http, alias='type')

scheme instance-attribute

  1. scheme

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

HTTPBearer

Bases: [HTTPBase](#fastapi.openapi.models.HTTPBase "fastapi.openapi.models.HTTPBase")

type_ class-attribute instance-attribute

  1. type_ = Field(default=http, alias='type')

description class-attribute instance-attribute

  1. description = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

scheme class-attribute instance-attribute

  1. scheme = 'bearer'

bearerFormat class-attribute instance-attribute

  1. bearerFormat = None

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

OAuthFlow

Bases: BaseModel

refreshUrl class-attribute instance-attribute

  1. refreshUrl = None

scopes class-attribute instance-attribute

  1. scopes = {}

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

OAuthFlowImplicit

Bases: [OAuthFlow](#fastapi.openapi.models.OAuthFlow "fastapi.openapi.models.OAuthFlow")

refreshUrl class-attribute instance-attribute

  1. refreshUrl = None

scopes class-attribute instance-attribute

  1. scopes = {}

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

authorizationUrl instance-attribute

  1. authorizationUrl

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

OAuthFlowPassword

Bases: [OAuthFlow](#fastapi.openapi.models.OAuthFlow "fastapi.openapi.models.OAuthFlow")

refreshUrl class-attribute instance-attribute

  1. refreshUrl = None

scopes class-attribute instance-attribute

  1. scopes = {}

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

tokenUrl instance-attribute

  1. tokenUrl

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

OAuthFlowClientCredentials

Bases: [OAuthFlow](#fastapi.openapi.models.OAuthFlow "fastapi.openapi.models.OAuthFlow")

refreshUrl class-attribute instance-attribute

  1. refreshUrl = None

scopes class-attribute instance-attribute

  1. scopes = {}

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

tokenUrl instance-attribute

  1. tokenUrl

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

OAuthFlowAuthorizationCode

Bases: [OAuthFlow](#fastapi.openapi.models.OAuthFlow "fastapi.openapi.models.OAuthFlow")

refreshUrl class-attribute instance-attribute

  1. refreshUrl = None

scopes class-attribute instance-attribute

  1. scopes = {}

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

authorizationUrl instance-attribute

  1. authorizationUrl

tokenUrl instance-attribute

  1. tokenUrl

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

OAuthFlows

Bases: BaseModel

implicit class-attribute instance-attribute

  1. implicit = None

password class-attribute instance-attribute

  1. password = None

clientCredentials class-attribute instance-attribute

  1. clientCredentials = None

authorizationCode class-attribute instance-attribute

  1. authorizationCode = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

OAuth2

Bases: [SecurityBase](#fastapi.openapi.models.SecurityBase "fastapi.openapi.models.SecurityBase")

description class-attribute instance-attribute

  1. description = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

type_ class-attribute instance-attribute

  1. type_ = Field(default=oauth2, alias='type')

flows instance-attribute

  1. flows

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

OpenIdConnect

Bases: [SecurityBase](#fastapi.openapi.models.SecurityBase "fastapi.openapi.models.SecurityBase")

description class-attribute instance-attribute

  1. description = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

type_ class-attribute instance-attribute

  1. type_ = Field(default=openIdConnect, alias='type')

openIdConnectUrl instance-attribute

  1. openIdConnectUrl

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

Components

Bases: BaseModel

schemas class-attribute instance-attribute

  1. schemas = None

responses class-attribute instance-attribute

  1. responses = None

parameters class-attribute instance-attribute

  1. parameters = None

examples class-attribute instance-attribute

  1. examples = None

requestBodies class-attribute instance-attribute

  1. requestBodies = None

headers class-attribute instance-attribute

  1. headers = None

securitySchemes class-attribute instance-attribute

  1. securitySchemes = None
  1. links = None

callbacks class-attribute instance-attribute

  1. callbacks = None

pathItems class-attribute instance-attribute

  1. pathItems = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

Tag

Bases: BaseModel

name instance-attribute

  1. name

description class-attribute instance-attribute

  1. description = None

externalDocs class-attribute instance-attribute

  1. externalDocs = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'

OpenAPI

Bases: BaseModel

openapi instance-attribute

  1. openapi

info instance-attribute

  1. info

jsonSchemaDialect class-attribute instance-attribute

  1. jsonSchemaDialect = None

servers class-attribute instance-attribute

  1. servers = None

paths class-attribute instance-attribute

  1. paths = None

webhooks class-attribute instance-attribute

  1. webhooks = None

components class-attribute instance-attribute

  1. components = None

security class-attribute instance-attribute

  1. security = None

tags class-attribute instance-attribute

  1. tags = None

externalDocs class-attribute instance-attribute

  1. externalDocs = None

model_config class-attribute instance-attribute

  1. model_config = {'extra': 'allow'}

Config

extra class-attribute instance-attribute
  1. extra = 'allow'