Although max length is defined with 100 character by schema, clients cannot use email address longer than 80 characters.
This is because pydantic.EmailStr validation rejects email address over 80 characters.
from pydantic.networks import validate_email
test_email_address = "a"*80+"@example.com"
len(test_email_address)
> 92
validate_email(test_email_address)
Traceback (most recent call last):
File "/Users/y-otosu/.anyenv/envs/pyenv/versions/ibet-Wallet-API/lib/python3.11/site-packages/pydantic/networks.py", line 696, in validate_email
parts = email_validator.validate_email(email, check_deliverability=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/y-otosu/.anyenv/envs/pyenv/versions/ibet-Wallet-API/lib/python3.11/site-packages/email_validator/validate_email.py", line 71, in validate_email
local_part_info = validate_email_local_part(local_part,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/y-otosu/.anyenv/envs/pyenv/versions/ibet-Wallet-API/lib/python3.11/site-packages/email_validator/syntax.py", line 93, in validate_email_local_part
raise EmailSyntaxError(f"The email address is too long before the @-sign {reason}.")
email_validator.exceptions_types.EmailSyntaxError: The email address is too long before the @-sign (16 characters too many).
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/y-otosu/.anyenv/envs/pyenv/versions/ibet-Wallet-API/lib/python3.11/site-packages/pydantic/networks.py", line 698, in validate_email
raise PydanticCustomError(
pydantic_core._pydantic_core.PydanticCustomError: value is not a valid email address: The email address is too long before the @-sign (16 characters too many).
Expected behavior
Clients can send emails to email addresses of 100 characters
Describe the bug
https://github.com/BoostryJP/ibet-Wallet-API/blob/4d98ef19541ae04d3bcf2ee38889a806a541d09c/app/model/schema/messaging.py#L65-L66
pydantic.EmailStr
validation rejects email address over 80 characters.Expected behavior