api schema check
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-09-26 07:28:07 +09:00
parent e5aa933cf9
commit ed8eb75bac
96 changed files with 24213 additions and 13 deletions

View File

@@ -108,10 +108,21 @@ class UserLogin(BaseModel):
@classmethod
def validate_password_bytes(cls, v):
"""Ensure password doesn't exceed bcrypt's 72-byte limit."""
if not v or len(v.strip()) == 0:
raise ValueError("Password cannot be empty")
password_bytes = v.encode('utf-8')
if len(password_bytes) > 72:
raise ValueError("Password is too long when encoded as UTF-8 (max 72 bytes for bcrypt)")
return v
@field_validator("username")
@classmethod
def validate_login_fields(cls, v, info):
"""Ensure at least email or username is provided."""
email = info.data.get('email')
if not email and not v:
raise ValueError("Either email or username must be provided")
return v
class Token(BaseModel):