You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
If you have a model which defines an EmailField, the generated OpenAPI specification is displayed as: email string <= 254 characters
If you manually define this email field as email: pydantic.EmailStr in your schema, it will be displayed as: email string email
I noticed the same issue with Django's URLField, which is displayed as a regular string, but if you annotate it with pydantic.HttpUrl in your schema, it will be displayed with the OpenAPI string format uri
Is your feature request related to a problem? Please describe.
If you have a model which defines an
EmailField
, the generated OpenAPI specification is displayed as:email string <= 254 characters
If you manually define this email field as
email: pydantic.EmailStr
in your schema, it will be displayed as:email string email
So in this case, the string format
email
is used:https://swagger.io/docs/specification/v3_0/data-models/data-types/#strings
Describe the solution you'd like
Automatically map Django's
EmailField
to OpenAPI string formatemail
There are probably other Django field classes, which could be enhanced with string formats to be more precise
The text was updated successfully, but these errors were encountered: