0

I have a GET request that accepts parameters that were defined as class dependencies like in the FastAPI Docs.

I already had a problem including a list of strings as a property of the dependency class, but I solved it.

However now I want a list of objects to be a property of the dependency class, but it seems that FastAPI cannot handle list of complex objects in such a situation.

Does anybody have an idea on how I can define something like the following and not having FastAPI about handling list of complex objects in GET requests?

This is an example that fails:

class Foo(BaseModel):
  some_property:int
  list_of_objects:list(some_obj)

@app.get("/items/")
async def read_items(commons: Annotated[Foo, Depends()]):
  ...
Bastien B
  • 1,018
  • 8
  • 25
user2465039
  • 894
  • 1
  • 11
  • 28
  • Does [this](https://stackoverflow.com/a/71554017/17865804) or [this](https://stackoverflow.com/a/70840850/17865804) answer your question? – Chris Aug 30 '23 at 09:37

0 Answers0