AttributeError when trying to access properties of a FastAPI response model in Python 3.11
I'm working on a FastAPI application where I'm trying to return a custom response model after a database operation. I have defined a Pydantic model for the response, but when I try to access its properties after returning it, I run into an `AttributeError`. Here's a simplified version of my code: ```python from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): id: int name: str @app.post("/items/", response_model=Item) async def create_item(item: Item): # Simulate saving to the database and returning the instance return Item(id=1, name=item.name) @app.get("/items/{item_id}") async def read_item(item_id: int): item = await create_item(Item(id=0, name="Sample")) print(item.name) return item ``` When I make a POST request to `/items/`, it works fine and returns the expected JSON response. However, in the `read_item` function, when I try to access `item.name`, I get the following behavior: ``` AttributeError: 'coroutine' object has no attribute 'name' ``` I suspect this scenario is related to the fact that `create_item` is an asynchronous function, but I am not sure how to handle the response correctly. I've tried using `await create_item(...)` in the `read_item` function, but that leads to another behavior. Can someone help clarify how to properly await the result and access its properties without running into this scenario? My development environment is Ubuntu. Thanks in advance! This issue appeared after updating to Python LTS. Any suggestions would be helpful. This is for a application running on Debian. Any suggestions would be helpful.