Closed PARKER-X closed 1 year ago
@PARKER-X post a sample of the error.
@PARKER-X post a sample of the error.
I think these error produced by redis fastapi.exceptions.FastAPIError: Invalid args for response field! Hint: check that <class 'inventory.schema.Product'> is a valid Pydantic field type. If you are using a return type annotation that is not a valid Pydantic field (e.g. Union[Response, dict, None]) you can disable generating the response model from the type annotation with the path operation decorator parameter response_model=None. Read more: https://fastapi.tiangolo.com/tutorial/response-model/
below is the changes I made to get it working. `from pydantic import BaseModel
class ProductCreate(BaseModel): name: str price: float quantity: int
@app.post('/products') def create(product: ProductCreate): print("product found", product) new_product = Product(**product.dict()) new_product.save() return new_product `
@vcnwafor It's not working yet
@vcnwafor Finally error resolved i need to install pydantic version 1 redis_om didn;t support pydantic v2ans now error is resolved Thanks!
My code https://github.com/scalablescripts/fastapi-microservices/tree/master/inventory Post requst gives error