Skip to content

Commit 3d56109

Browse files
committed
fix(spp_api_v2_change_request): use Literal type for finite-valued str fields
Replace plain str with Literal for fields that have a known, fixed set of valid values: ChangeRequestResponse.status and ChangeRequestTypeInfo.target_type. This provides stricter validation and clearer API documentation.
1 parent d857cf8 commit 3d56109

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

spp_api_v2_change_request/schemas/change_request.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,9 @@ class ChangeRequestResponse(BaseModel):
103103
request_type: ChangeRequestType = Field(..., alias="requestType")
104104

105105
# Status
106-
status: str = Field(
106+
status: Literal["draft", "pending", "revision", "approved", "rejected", "applied"] = Field(
107107
...,
108108
description="Current status",
109-
json_schema_extra={"enum": ["draft", "pending", "revision", "approved", "rejected", "applied"]},
110109
)
111110

112111
# Target registrant
@@ -202,7 +201,9 @@ class ChangeRequestTypeInfo(BaseModel):
202201

203202
code: str = Field(..., description="Type code (e.g., add_member)")
204203
name: str = Field(..., description="Human-readable type name")
205-
target_type: str = Field(..., alias="targetType", description="Target registrant type (individual, group, both)")
204+
target_type: Literal["individual", "group", "both"] = Field(
205+
..., alias="targetType", description="Target registrant type"
206+
)
206207
requires_applicant: bool = Field(False, alias="requiresApplicant", description="Whether an applicant is required")
207208

208209
class Config:

0 commit comments

Comments
 (0)