title: Problem with get method of a nested data model FastAPI
body: <p>I´m developing a project (Angularjs for the front, FastAPI and MongoDB for the back) about <strong>Practical Cases</strong> and I've come across the following issue: when I try to use the <em>get</em> method to retreive all the cases the following error appears:</p>
  <pre><code>pydantic.error_wrappers.ValidationError: 1 validation error for Case
  response -&gt; 0 -&gt; id
  str type expected (type=type_error.str)
  </code></pre>
  <p>My data models are as follows:</p>
  <pre><code>from typing import Optional, List
  from pydantic import BaseModel
  
  class Answer(BaseModel):
   id: str
   description: str
   required: bool
   value: int
  
  
  class SubOption(BaseModel):
   id: str
   description: str
   answer: Answer
  
  
  class Option(BaseModel):
   id: str
   description: str
   suboption: Optional[List[SubOption]]
   answer: Answer
  
  
  class SubMenu(BaseModel):
   id: str
   description: str
   option: List[Option]
  
  
  class Menu(BaseModel):
   id: str
   description: str
   submenu: List[SubMenu]
  
  class Case(BaseModel):
   id: str
   description: str
   menu: List[Menu]
  </code></pre>
  <p>The methods:</p>
  <pre><code>def practicalCase(case) -&gt; dict:
  return{
       &quot;id&quot;: case[&quot;_id&quot;],
        &quot;description&quot;: case[&quot;description&quot;],
        &quot;menu&quot;: case[&quot;menu&quot;]
  }
  
  def listCases(entity) -&gt; list:
  return [clinicalCase(case) for case in entity]
  </code></pre>
  <p>And the CRUD operations:</p>
  <pre><code>@case.get('/cases', response_model=list[Case], tags=[&quot;case&quot;])
  async def all_cases():
      return listCases(ven.local.cases.find())
  
  @case.post('/newcases', response_model=Case, tags=[&quot;case&quot;])
  async def new_case(case: Case):
      case_new = dict(case)
      del case_new[&quot;id&quot;]
      json_compatible_item_data = jsonable_encoder(case_new) 
      id = ven.local.cases.insert_one(json_compatible_item_data).inserted_id
      case = ven.local.cases.find_one({&quot;_id&quot;: id})
  
      ven.local.cases.find_one({&quot;_id&quot;: id})
  </code></pre>
  <p>I´ve tried many different things, from adjusting the data models using Field(...) to trying to apend the menu dict to the case dict, but to no aveil.</p>
  <p>Any kind of help/hint would be welcome. Thanks in advance</p>