🐛 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:
Sebastián Ramírez authored and GitHub committed 2019-06-03 21:59:40 +04:00
1 parent 2a7ef5504a
commit c7db2ff858
7 files changed
+227 -3

No files matched your search

@@ -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.