Merge pull request #39571 from BerriAI/codex/team-id-empty-field

fix(team): generate team IDs for blank input
This commit is contained in:
yujonglee 2026-09-03 10:35:01 -07:00 committed by GitHub
parent 7256bd307a
commit bb7d787425
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View file

@ -1930,6 +1930,13 @@ class NewTeamRequest(TeamBase):
model_config = ConfigDict(protected_namespaces=())
@field_validator("team_id", mode="before")
@classmethod
def treat_blank_team_id_as_unset(cls, v: object) -> object:
if isinstance(v, str) and not v.strip():
return None
return v
class GlobalEndUsersSpend(LiteLLMPydanticObjectBase):
api_key: str | None = None

View file

@ -11083,6 +11083,14 @@ async def test_new_team_rejects_reserved_ui_session_team_id():
mock_prisma.get_data.assert_not_called()
@pytest.mark.parametrize("team_id", ["", " "])
def test_new_team_request_blank_team_id_is_unset(team_id: str) -> None:
from litellm.proxy._types import NewTeamRequest
assert NewTeamRequest(team_alias="t", team_id=team_id).team_id is None
assert NewTeamRequest(team_id="custom").team_id == "custom"
# ---------------------------------------------------------------------------
# PATCH /team/{team_id} — RFC 7386 JSON Merge Patch
#