Skip to content

EmailStr

faststream.asyncapi.schema.info.EmailStr #

Bases: str

EmailStr is a string that should be an email.

Note: EmailStr mock was copied from the FastAPI: https://github.com/tiangolo/fastapi/blob/master/fastapi/openapi/models.py#24

validate classmethod #

validate(v)

Validates the EmailStr class.

Source code in faststream/asyncapi/schema/info.py
@classmethod
def validate(cls, v: Any) -> str:
    """Validates the EmailStr class."""
    logger.warning(
        "email-validator bot installed, email fields will be treated as str.\n"
        "To install, run: pip install email-validator"
    )
    return str(v)