fix: refine CanonicalUser model by removing unnecessary newline and simplifying source_system field definition
This commit is contained in:
parent
88089d712c
commit
7e74d19ba7
@ -29,7 +29,6 @@ class UserStatus(str, Enum):
|
|||||||
SUSPENDED = "suspended"
|
SUSPENDED = "suspended"
|
||||||
TERMINATED = "terminated"
|
TERMINATED = "terminated"
|
||||||
|
|
||||||
|
|
||||||
class CanonicalUser(BaseModel):
|
class CanonicalUser(BaseModel):
|
||||||
"""Normalized user object across AD, Entra, and Workday.
|
"""Normalized user object across AD, Entra, and Workday.
|
||||||
|
|
||||||
@ -62,9 +61,7 @@ class CanonicalUser(BaseModel):
|
|||||||
phone: Optional[str] = None
|
phone: Optional[str] = None
|
||||||
|
|
||||||
# Source tracking
|
# Source tracking
|
||||||
source_system: Literal["ActiveDirectory", "Entra", "Workday"] = Field(
|
source_system: Literal["ActiveDirectory", "Entra", "Workday"] = Field(description="System this data came from")
|
||||||
description="System this data came from"
|
|
||||||
)
|
|
||||||
source_id: Optional[str] = Field(default=None, description="Native ID in source system")
|
source_id: Optional[str] = Field(default=None, description="Native ID in source system")
|
||||||
|
|
||||||
@field_validator('email')
|
@field_validator('email')
|
||||||
@ -75,9 +72,9 @@ class CanonicalUser(BaseModel):
|
|||||||
|
|
||||||
@field_validator('username')
|
@field_validator('username')
|
||||||
@classmethod
|
@classmethod
|
||||||
def normalize_username(cls, v: Optional[str]) -> Optional[str]:
|
def normalize_username(cls, v: str) -> str:
|
||||||
"""Normalize username to lowercase."""
|
"""Normalize username to lowercase."""
|
||||||
return v.lower().strip() if v else None
|
return v.lower().strip()
|
||||||
|
|
||||||
model_config = ConfigDict(
|
model_config = ConfigDict(
|
||||||
extra="forbid" # Stops silent adapter drift
|
extra="forbid" # Stops silent adapter drift
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user