Optional query params with None not working
tuenut opened this issue · comments
Hello! I have code like below:
class PaginationParams(Group):
page: Optional[int] = 1
page_size: Optional[int] = 100
class MyApiView(PydanticView):
async def get(self, pagination: PaginationParams):
...
And it works perfectly, but if I change the default values to None
, the view responds with validation error details in the response:
[{"type": "missing", "loc": ["page"], "msg": "Field required", "input": {}, "in": "query string"}, {"type": "missing", "loc": ["page_size"], "msg": "Field required", "input": {}, "in": "query string"}]
For pagination parameters, it is not critical, but for filter parameters, it may be necessary.
Thanks for the bug report. It's fixed
Released in version 2.1.1