-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: mentioned workaround for using pydantic models along with other…
… query params
- Loading branch information
1 parent
132aac4
commit 900adb4
Showing
5 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+41.9 KB
...es/examples/fastapi/dependencies/fastapi_pydantic_model_n_query_param_issue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+37.2 KB
...es/fastapi/dependencies/fastapi_pydantic_model_n_query_param_issue_resolved.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
examples/fastapi/dependencies/fastapi_pydantic_model_n_query_param_issue__py313.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from typing import Annotated | ||
|
||
from fastapi import FastAPI, Query | ||
|
||
from fastapi_batteries.pydantic.schemas import PaginationPageSize | ||
|
||
app = FastAPI() | ||
|
||
|
||
@app.get("/items/") | ||
async def get_items_page_size_pagination( | ||
pagination: Annotated[PaginationPageSize, Query()], | ||
q: str = "", | ||
): | ||
return {"q": q, "pagination": pagination} |
15 changes: 15 additions & 0 deletions
15
...ples/fastapi/dependencies/fastapi_pydantic_model_n_query_param_issue_workaround__py313.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from typing import Annotated | ||
|
||
from fastapi import Depends, FastAPI | ||
|
||
from fastapi_batteries.pydantic.schemas import PaginationPageSize | ||
|
||
app = FastAPI() | ||
|
||
|
||
@app.get("/items/") | ||
async def get_items_page_size_pagination( | ||
pagination: Annotated[PaginationPageSize, Depends()], | ||
q: str = "", | ||
): | ||
return {"q": q, "pagination": pagination} |