Thanks for sharing that! It looks like you're working with FastAPI and Pydantic, and you're running into an issue where nested models aren't showing up correctly in the response. Let's break it down and fix it. 🔧
🧩 Problem Summary
You're defining a response model like this:
The issue is with this line:
data: BaseModel | None = None
Using BaseModel
as a type hint doesn't tell Pydantic what specific model to expect. It needs a concrete subclass of BaseModel
to properly serialize the nested data.