question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError raised when using response_model in FastAPI route decorator

See original GitHub issue

According to FastAPI’s docs, response_model can accept type annotations that are not pydantic models. However, the code referenced below is checking for the __fields__ attribute, which won’t be on type annotations such as list[float], for example.

https://github.com/ray-project/ray/blob/e60a5f52eb93c851b186cb78fa1f70dbad4e52e7/python/ray/serve/http_util.py#L219-L227

I’m just getting started using ray (thank you for all your work!) so I’m not sure how you’d all like to handle this scenario (or if you want to handle it at all.)

I’m happy to submit a PR if you all have an idea of what you’d like to do. Just let me know.

Thanks!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

Handling Errors - FastAPI
When a request contains invalid data, FastAPI internally raises a RequestValidationError . And it also includes a default exception handler for it. To...
Read more >
AttributeError: 'Blog' object has no attribute 'items' - FastAPI
The error is only raised for the update query. AttributeError: 'Blog' object has no attribute 'items'. Here is the relevant code.
Read more >
tiangolo/fastapi - Gitter
upgrading is ok :) thanks, just wondering now if I should use raise at the ... @euri10 that's the reason why the endpoint...
Read more >
Developing RESTful APIs with Python and Flask - Auth0
We'll update the code soon with latest versions of Flask and Python. To answer this again the error you encountered was because of...
Read more >
Developing and Testing an Asynchronous API with FastAPI ...
Databases v0.6.2. Contents. Objectives; FastAPI; Project Setup; Test Setup; Async Handlers; Routes; Postgres Setup; Models.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found