title: pydantic.error_wrappers.ValidationError: 1 validation error for '' with FastAPI
body: <p>I have these Schemas in my FastAPI application:</p>
  <pre><code>class Run(BaseModel):
      id: int = Field(..., description=&quot;Run id&quot;)
      type: str = Field(..., description=&quot;Type&quot;)
  
  
  class RunsResponse(BaseModel):
      data: list[Run] = Field(..., description=&quot;List of existing runs&quot;)
      links: dict = Field(..., description=&quot;link to runs&quot;)
  </code></pre>
  <p>Then I have this decorator to use for all the endpoints:</p>
  <pre><code>def handle_request(func):
      @wraps(func)
      async def wrapper(*args, **kwargs):
          try:
              response = func(*args, **kwargs)
          except (requests.exceptions.SSLError, requests.exceptions.RequestException) as ex:
              raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(ex))
  
          return response
  
      return wrapper
  </code></pre>
  <p>And this route:</p>
  <pre><code>@router.get(
      &quot;/runs&quot;,
      response_model=RunsResponse,
  )
  @handle_request
  async def get_runs(request: Request) -&gt; JSONResponse:
      response = send_request(request, SOME_URL)
  
      return JSONResponse(content=response)
  </code></pre>
  <p>So if I try the api without having those codes in a decorator, everything works fine. But when I put the codes in a decorator and use it on my router function, I get this error:</p>
  <blockquote>
  <p>pydantic.error_wrappers.ValidationError: 1 validation error for RunsResponse</p>
  <p>response</p>
  <p>value is not a valid dict (type=type_error.dict)</p>
  </blockquote>
  <p>I can't debug the code cause the error happens right after I press the <em>Execute</em> button in Swagger. I suspect it has something to do with <code>@wraps</code> from <code>functools</code> but I can't figure out how to fix it.</p>
  <p>Can anyone help me with this please?</p>
  <p><strong>UPDATE:</strong></p>
  <p>I'm adding the <code>send_request</code> method, just in case:</p>
  <pre><code>def send_request(request: Request, url: str) -&gt; dict:
      headers = {
          &quot;Content-type&quot;: &quot;application/json&quot;,
          &quot;Accept&quot;: &quot;application/json&quot;,
      }
      response = requests.get(url, headers=headers)
      data = response.json()
  
      return data
  </code></pre>