Strange unstable behavior #13720
Answered
by
sachinh35
shurshilov
asked this question in
Questions
-
First Check
Commit to Help
Example Code#I have 2 similar routes
#1
@router.get("/api/users/", response_model=list[UserListResponse])
async def get_users(req: Request, include_me: IntBool = IntBool.FALSE):
"""
Get user list
"""
...
#2
@router.get("/api/client_list/", response_model=list[BypassesResponse])
async def get_client_list(req: Request):
"""
Returns clients list
"""
#custom annotation
MAX_UINT_32: Final[int] = 2**32 - 1
Id = Annotated[int, Field(..., ge=1, le=MAX_UINT_32)]
#two model
#1
class UserListResponse(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
id: Id = Field(description="id user")
#2
class BypassesResponse(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
id: Id = Field(..., description="id client") DescriptionI have 2 similar routes
2
MAX_UINT_32: Final[int] = 2**32 - 1
And 2 response models
2
But in Swagger first ID required and Second ID not required Operating SystemWindows Operating System DetailsNo response FastAPI Version115.8 Pydantic Version2.10.6 Python Version3.11 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Answered by
sachinh35
May 15, 2025
Replies: 1 comment · 1 reply
-
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
YuriiMotov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I wasn't able to fully replicate the issue on my end. I don't have a windows machine though. Here's what I used.
Details about python packages
Details about fastapi app