I want to pass in a list of the class declared in the FastAPI service, something like :
@router.post("/predict")
async def predict(json_list: List[my_class])-> dict:
And I got exception: 'my_class' object is not subscriptable
What is the correct way to pass in a list of class with FastAPI? TIA!
my_classdefined as? Is it actual Pydantic class? On what line does the exception get raised? It seems like you're trying to access a list index onmy_class, not onjson_list?