mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-16 04:53:11 -04:00
🐛 Fix path and query parameters receiving dict as valid (#287)
* 🐛 Fix path and query parameters accepting dict * ✅ Add several tests to ensure invalid types are not accepted * 📝 Document (to include tested source) using query params with list * 🐛 Fix OpenAPI schema in query with list tutorial
This commit is contained in:
committed by
GitHub
parent
2a7ef5504a
commit
c7db2ff858
@@ -183,6 +183,19 @@ the default of `q` will be: `["foo", "bar"]` and your response will be:
|
||||
}
|
||||
```
|
||||
|
||||
#### Using `list`
|
||||
|
||||
You can also use `list` directly instead of `List[str]`:
|
||||
|
||||
```Python hl_lines="7"
|
||||
{!./src/query_params_str_validations/tutorial013.py!}
|
||||
```
|
||||
|
||||
!!! note
|
||||
Have in mind that in this case, FastAPI won't check the contents of the list.
|
||||
|
||||
For example, `List[int]` would check (and document) that the contents of the list are integers. But `list` alone wouldn't.
|
||||
|
||||
## Declare more metadata
|
||||
|
||||
You can add more information about the parameter.
|
||||
|
||||
Reference in New Issue
Block a user