OpenAPI models
OpenAPI Pydantic models used to generate and validate the generated OpenAPI.
fastapi.openapi.models
SchemaOrBool
module-attribute
SchemaOrBool = Union[Schema, bool]
SecurityScheme
module-attribute
SecurityScheme = Union[
APIKey, HTTPBase, OAuth2, OpenIdConnect, HTTPBearer
]
EmailStr
Bases: str
validate
classmethod
PARAMETER |
DESCRIPTION |
v |
TYPE:
Any
|
Source code in fastapi/openapi/models.py
| @classmethod
def validate(cls, v: Any) -> str:
logger.warning(
"email-validator not installed, email fields will be treated as str.\n"
"To install, run: pip install email-validator"
)
return str(v)
|
Bases: BaseModel
model_config = {'extra': 'allow'}
License
Bases: BaseModel
identifier
class-attribute
instance-attribute
url
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
Info
Bases: BaseModel
summary
class-attribute
instance-attribute
description
class-attribute
instance-attribute
termsOfService
class-attribute
instance-attribute
license
class-attribute
instance-attribute
version
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
ServerVariable
Bases: BaseModel
enum
class-attribute
instance-attribute
default
instance-attribute
description
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
Server
Bases: BaseModel
description
class-attribute
instance-attribute
variables
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
Reference
Bases: BaseModel
ref
class-attribute
instance-attribute
ref = Field(alias='$ref')
Discriminator
Bases: BaseModel
propertyName
instance-attribute
mapping
class-attribute
instance-attribute
XML
Bases: BaseModel
name
class-attribute
instance-attribute
namespace
class-attribute
instance-attribute
prefix
class-attribute
instance-attribute
attribute
class-attribute
instance-attribute
wrapped
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
ExternalDocumentation
Bases: BaseModel
description
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
Schema
Bases: BaseModel
schema_
class-attribute
instance-attribute
schema_ = Field(default=None, alias='$schema')
vocabulary
class-attribute
instance-attribute
vocabulary = Field(default=None, alias='$vocabulary')
id
class-attribute
instance-attribute
id = Field(default=None, alias='$id')
anchor
class-attribute
instance-attribute
anchor = Field(default=None, alias='$anchor')
dynamicAnchor
class-attribute
instance-attribute
dynamicAnchor = Field(default=None, alias='$dynamicAnchor')
ref
class-attribute
instance-attribute
ref = Field(default=None, alias='$ref')
dynamicRef
class-attribute
instance-attribute
dynamicRef = Field(default=None, alias='$dynamicRef')
defs
class-attribute
instance-attribute
defs = Field(default=None, alias='$defs')
comment = Field(default=None, alias='$comment')
allOf
class-attribute
instance-attribute
anyOf
class-attribute
instance-attribute
oneOf
class-attribute
instance-attribute
not_
class-attribute
instance-attribute
not_ = Field(default=None, alias='not')
if_
class-attribute
instance-attribute
if_ = Field(default=None, alias='if')
then
class-attribute
instance-attribute
else_
class-attribute
instance-attribute
else_ = Field(default=None, alias='else')
dependentSchemas
class-attribute
instance-attribute
prefixItems
class-attribute
instance-attribute
items
class-attribute
instance-attribute
contains
class-attribute
instance-attribute
properties
class-attribute
instance-attribute
patternProperties
class-attribute
instance-attribute
additionalProperties
class-attribute
instance-attribute
additionalProperties = None
propertyNames
class-attribute
instance-attribute
unevaluatedItems
class-attribute
instance-attribute
unevaluatedProperties
class-attribute
instance-attribute
unevaluatedProperties = None
type
class-attribute
instance-attribute
enum
class-attribute
instance-attribute
const
class-attribute
instance-attribute
multipleOf
class-attribute
instance-attribute
multipleOf = Field(default=None, gt=0)
maximum
class-attribute
instance-attribute
exclusiveMaximum
class-attribute
instance-attribute
minimum
class-attribute
instance-attribute
exclusiveMinimum
class-attribute
instance-attribute
maxLength
class-attribute
instance-attribute
maxLength = Field(default=None, ge=0)
minLength
class-attribute
instance-attribute
minLength = Field(default=None, ge=0)
pattern
class-attribute
instance-attribute
maxItems
class-attribute
instance-attribute
maxItems = Field(default=None, ge=0)
minItems
class-attribute
instance-attribute
minItems = Field(default=None, ge=0)
uniqueItems
class-attribute
instance-attribute
maxContains
class-attribute
instance-attribute
maxContains = Field(default=None, ge=0)
minContains
class-attribute
instance-attribute
minContains = Field(default=None, ge=0)
maxProperties
class-attribute
instance-attribute
maxProperties = Field(default=None, ge=0)
minProperties
class-attribute
instance-attribute
minProperties = Field(default=None, ge=0)
required
class-attribute
instance-attribute
dependentRequired
class-attribute
instance-attribute
contentEncoding
class-attribute
instance-attribute
contentMediaType
class-attribute
instance-attribute
contentSchema
class-attribute
instance-attribute
title
class-attribute
instance-attribute
description
class-attribute
instance-attribute
default
class-attribute
instance-attribute
deprecated
class-attribute
instance-attribute
readOnly
class-attribute
instance-attribute
writeOnly
class-attribute
instance-attribute
examples
class-attribute
instance-attribute
discriminator
class-attribute
instance-attribute
xml
class-attribute
instance-attribute
externalDocs
class-attribute
instance-attribute
example
class-attribute
instance-attribute
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
model_config = {'extra': 'allow'}
Example
Bases: TypedDict
summary
instance-attribute
description
instance-attribute
externalValue
instance-attribute
ParameterInType
Bases: Enum
query
class-attribute
instance-attribute
path
class-attribute
instance-attribute
cookie
class-attribute
instance-attribute
Encoding
Bases: BaseModel
contentType
class-attribute
instance-attribute
style
class-attribute
instance-attribute
explode
class-attribute
instance-attribute
allowReserved
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
Bases: BaseModel
schema_ = Field(default=None, alias='schema')
model_config = {'extra': 'allow'}
ParameterBase
Bases: BaseModel
description
class-attribute
instance-attribute
required
class-attribute
instance-attribute
deprecated
class-attribute
instance-attribute
style
class-attribute
instance-attribute
explode
class-attribute
instance-attribute
allowReserved
class-attribute
instance-attribute
schema_
class-attribute
instance-attribute
schema_ = Field(default=None, alias='schema')
example
class-attribute
instance-attribute
examples
class-attribute
instance-attribute
content
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
Parameter
Bases: ParameterBase
description
class-attribute
instance-attribute
required
class-attribute
instance-attribute
deprecated
class-attribute
instance-attribute
style
class-attribute
instance-attribute
explode
class-attribute
instance-attribute
allowReserved
class-attribute
instance-attribute
schema_
class-attribute
instance-attribute
schema_ = Field(default=None, alias='schema')
example
class-attribute
instance-attribute
examples
class-attribute
instance-attribute
content
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
in_
class-attribute
instance-attribute
RequestBody
Bases: BaseModel
description
class-attribute
instance-attribute
content
instance-attribute
required
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
Config
extra
class-attribute
instance-attribute
Link
Bases: BaseModel
operationRef
class-attribute
instance-attribute
operationId
class-attribute
instance-attribute
parameters
class-attribute
instance-attribute
requestBody
class-attribute
instance-attribute
description
class-attribute
instance-attribute
server
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
Response
Bases: BaseModel
description
instance-attribute
content
class-attribute
instance-attribute
links
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
Operation
Bases: BaseModel
summary
class-attribute
instance-attribute
description
class-attribute
instance-attribute
externalDocs
class-attribute
instance-attribute
operationId
class-attribute
instance-attribute
parameters
class-attribute
instance-attribute
requestBody
class-attribute
instance-attribute
responses
class-attribute
instance-attribute
callbacks
class-attribute
instance-attribute
deprecated
class-attribute
instance-attribute
security
class-attribute
instance-attribute
servers
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
PathItem
Bases: BaseModel
ref
class-attribute
instance-attribute
ref = Field(default=None, alias='$ref')
summary
class-attribute
instance-attribute
description
class-attribute
instance-attribute
get
class-attribute
instance-attribute
put
class-attribute
instance-attribute
post
class-attribute
instance-attribute
delete
class-attribute
instance-attribute
options
class-attribute
instance-attribute
head
class-attribute
instance-attribute
patch
class-attribute
instance-attribute
trace
class-attribute
instance-attribute
servers
class-attribute
instance-attribute
parameters
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
SecuritySchemeType
Bases: Enum
apiKey
class-attribute
instance-attribute
http
class-attribute
instance-attribute
oauth2
class-attribute
instance-attribute
openIdConnect
class-attribute
instance-attribute
openIdConnect = 'openIdConnect'
SecurityBase
Bases: BaseModel
type_
class-attribute
instance-attribute
type_ = Field(alias='type')
description
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
APIKeyIn
Bases: Enum
query
class-attribute
instance-attribute
cookie
class-attribute
instance-attribute
APIKey
Bases: SecurityBase
description
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
type_
class-attribute
instance-attribute
type_ = Field(
default=SecuritySchemeType.apiKey, alias="type"
)
in_
class-attribute
instance-attribute
HTTPBase
Bases: SecurityBase
description
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
type_
class-attribute
instance-attribute
type_ = Field(default=SecuritySchemeType.http, alias="type")
scheme
instance-attribute
HTTPBearer
Bases: HTTPBase
type_
class-attribute
instance-attribute
type_ = Field(default=SecuritySchemeType.http, alias="type")
description
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
scheme
class-attribute
instance-attribute
OAuthFlow
Bases: BaseModel
refreshUrl
class-attribute
instance-attribute
scopes
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
OAuthFlowImplicit
Bases: OAuthFlow
refreshUrl
class-attribute
instance-attribute
scopes
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
authorizationUrl
instance-attribute
OAuthFlowPassword
Bases: OAuthFlow
refreshUrl
class-attribute
instance-attribute
scopes
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
tokenUrl
instance-attribute
OAuthFlowClientCredentials
Bases: OAuthFlow
refreshUrl
class-attribute
instance-attribute
scopes
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
tokenUrl
instance-attribute
OAuthFlowAuthorizationCode
Bases: OAuthFlow
refreshUrl
class-attribute
instance-attribute
scopes
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
authorizationUrl
instance-attribute
tokenUrl
instance-attribute
OAuthFlows
Bases: BaseModel
implicit
class-attribute
instance-attribute
password
class-attribute
instance-attribute
clientCredentials
class-attribute
instance-attribute
authorizationCode
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
OAuth2
Bases: SecurityBase
description
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
type_
class-attribute
instance-attribute
type_ = Field(
default=SecuritySchemeType.oauth2, alias="type"
)
OpenIdConnect
Bases: SecurityBase
description
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
type_
class-attribute
instance-attribute
type_ = Field(
default=SecuritySchemeType.openIdConnect, alias="type"
)
openIdConnectUrl
instance-attribute
Components
Bases: BaseModel
schemas
class-attribute
instance-attribute
responses
class-attribute
instance-attribute
parameters
class-attribute
instance-attribute
examples
class-attribute
instance-attribute
requestBodies
class-attribute
instance-attribute
securitySchemes
class-attribute
instance-attribute
links
class-attribute
instance-attribute
callbacks
class-attribute
instance-attribute
pathItems
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
Tag
Bases: BaseModel
description
class-attribute
instance-attribute
externalDocs
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}
OpenAPI
Bases: BaseModel
openapi
instance-attribute
jsonSchemaDialect
class-attribute
instance-attribute
servers
class-attribute
instance-attribute
paths
class-attribute
instance-attribute
webhooks
class-attribute
instance-attribute
components
class-attribute
instance-attribute
security
class-attribute
instance-attribute
externalDocs
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = {'extra': 'allow'}