I have a use case where I am accepting data of different datatypes - namely dict, boolean, string, int, list
- from the front end application to the FastAPI backedn using a pydantic model.
My question is how should I design my pydantic model so that it can accept any data type, which can later be used for manipulating the data and creating an API?
from pydantic import BaseModel
class Pino(BaseModel):
asset:str (The data is coming from the front end ((dict,boolean,string,int,list)) )
@app.post("/api/setAsset")
async def pino_kafka(item: Pino):
messages = {
"asset": item.asset
}