'FastAPI: List of lists output throwing errors
I have Python code that outputs list of lists. However, it will throw errors as many elements there are in the list. I tried both of these:
@app.post("/path/to/function", response_model = List[output])
# and
@app.post("/path/to/function", response_model = List[List[output]])
Error message:
pydantic.error_wrappers.ValidationError: 33 validation errors for HolidaysOut
response -> 0
value is not a valid dict (type=type_error.dict)
response -> 1
value is not a valid dict (type=type_error.dict)
...
response -> 32
value is not a valid dict (type=type_error.dict)
I'm unsure where type_error.dict came from, because there are absolutely no dictionary objects. Or is this implying that I need to convert this into a list of dictionaries?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
