I'm able to get requests like this with query parameters of a type list like this:
@router.get("/findStuff")
def get_stuff(a: List[int] = Query(None), b: List[str] = Query(None)):
return {'a': a, 'b': b}
But I'm not sure how I'd do this dynamically from an arbitrary Pydantic schema? When I do this, the query params are interpreted as a request body and cannot be processed from the OpenAPI doc. Is there a way to get the same behavior from above without explicitly specifying each query param in the method arguments?
class MySchema(BaseModel):
a: List[int] = Query(None)
b: List[str] = Query(None)
@router.get("/findStuff")
def get_stuff(inputs: MySchema = Depends()):
return inputs
