AttributeError raised when using response_model in FastAPI route decorator
See original GitHub issueAccording 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.
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:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sounds good.
@hibestil, you can edit the corresponding function in https://github.com/ray-project/ray/blob/master/python/ray/serve/http_util.py#L151-L246 and add test case here https://github.com/ray-project/ray/blob/master/python/ray/serve/tests/test_fastapi.py
we also have a contributor guide here https://docs.ray.io/en/latest/ray-contribute/getting-involved.html