Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Annotated types for Pydantic model fields #8547

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions server/parsec/asgi/administration.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
OrganizationUpdateBadOutcome,
)
from parsec.components.user import UserFreezeUserBadOutcome, UserInfo, UserListUsersBadOutcome
from parsec.events import OrganizationIDField
from parsec.events import ActiveUsersLimitField, OrganizationIDField, UserIDField
from parsec.logging import get_logger
from parsec.types import Unset, UnsetType

Expand Down Expand Up @@ -77,7 +77,7 @@ class CreateOrganizationIn(BaseModel):
# - missing field: ask the server to use its default value for this field
# - field set to `None`: `None` is a valid value to use for this field
user_profile_outsider_allowed: bool | Literal[UnsetType.Unset] = Unset
active_users_limit: ActiveUsersLimit | Literal[UnsetType.Unset] = Unset
active_users_limit: ActiveUsersLimitField | Literal[UnsetType.Unset] = Unset
minimum_archiving_period: int | Literal[UnsetType.Unset] = Unset

@field_validator("active_users_limit", mode="plain")
Expand Down Expand Up @@ -224,7 +224,7 @@ class PatchOrganizationIn(BaseModel):
# - missing field: ask the server to use its default value for this field
# - field set to `None`: `None` is a valid value to use for this field
user_profile_outsider_allowed: bool | Literal[UnsetType.Unset] = Unset
active_users_limit: ActiveUsersLimit | Literal[UnsetType.Unset] = Unset
active_users_limit: ActiveUsersLimitField | Literal[UnsetType.Unset] = Unset
minimum_archiving_period: Literal[UnsetType.Unset] | int = Unset

@field_validator("active_users_limit", mode="plain")
Expand Down Expand Up @@ -448,7 +448,7 @@ class UserFreezeIn(BaseModel):
model_config = ConfigDict(arbitrary_types_allowed=True, strict=True)
frozen: bool
user_email: str | None = None
user_id: UserID | None = None
user_id: UserIDField | None = None

@field_validator("user_id", mode="plain")
@classmethod
Expand Down