-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FastAPI 0.68.0 Breaks Usage of tuple in Input / Output compared to 0.67.0 #3665
Comments
What are you expecting a tuple in a form field to look like? |
I use class Model(BaseModel):
name: str
location: Tuple[float, float] This seems a legit use of tuple, no? |
I am also having this same problem, which I fixed by downgrading to fastapi version 0.67.0. Specific stack trace details, etc: #3686 (I closed my issue as it was a duplicate of this issue). |
According to this: https://stackoverflow.com/questions/57464633/how-to-define-a-json-array-with-concrete-item-definition-for-every-index-i-e-a it's possible to have tuples in openapi3.1. It could be great if @tiangolo could tell us if FastAPI will support Tuples again or if we need adapt our APIs. For now we are stuck in 0.67 |
@Mause I have an API that uses tuples in a few places as well. At the moment it looks like I will be forced to pin to 0.67.0 indefinitely to avoid breaking changes to my API. Do you know if there is a plan to fix this regression? |
@vdwees I'm not associated with the fastapi project so I can't help you sorry 😓 |
@Mause sorry, thanks anyway |
I wonder if this old issue is related #1507 |
There is a regression bug in FastAPI/Pydantic (see fastapi/fastapi#3665) that prevents the OpenAPI interactive documentation to render when we have models using `Tuple`. Since Tuple is currently used just in one place, we can temporarily replace it with a simple List, we will lose a bit of validation but still is not worth reverting back to a previous version of FastAPI because of this.
Is there any way to get @tiangolo 's attention on this issue? There are now at least 4 dupes of this issue (#3686, #3782, #3898, and #4168), and 2 open PRs (#3874 & #4169), each with exactly the same 1-line fix which works perfectly. We're all (anyone using tuples) stuck on version 0.67.0 until something is done... |
It's seems that FastAPI is not actively maintained anymore and nothing seems to be done to allow someone else to do it (source: #3970) |
downgrade fastapi to <v0.68 to avoid fastapi/fastapi#3665
I understand your frustration, I am also waiting for this to be fixed. However, I don't think your claim of FastAPI being unmaintained is true at all. For better or for worse, FastAPI is a project that stands on the shoulders of several other projects. Advocating for changes and improvements in those projects takes time. See this comment: https://news.ycombinator.com/item?id=29484907 |
@elrik75 I have the same thought. Look at the merged PR, most recent PR is doc translations and update dependencies. Here #1507 (comment) is the answer of this, but I don't think that's is a good solution. Patching with some workaround(like this PR) is better than waitting for support with bug |
Thanks for the discussion everyone! This should be solved by #3874 It is available in FastAPI For more context, check the last comment there: #3874 (comment) In short, using tuples now won't break the rest of Swagger UI. And although they are supported by OpenAPI 3.1.0, Swagger UI doesn't support OpenAPI 3.1.0 yet. Even though FastAPI already has a couple of corner cases where it is more compatible with 3.1.0, I can't change the generated version yet, as Swagger UI wouldn't render it at all. So, you can continue using tuples with FastAPI |
This issue is solved and can be closed. |
@MarioIshac can you close the issue? |
Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
First Check
Commit to Help
Example Code
Description
pip install uvicorn fastapi==0.68.0
.python ./main.py
localhost:8080/docs
, observe internal server error with below validation errors:pip install fastapi==0.67.0
localhost:8080/docs
, observe that endpoint documentation is successfully generated.Operating System
Linux
Operating System Details
Ubuntu 20.04
FastAPI Version
0.68.0 has bug, 0.67.0 does not have bug.
Python Version
3.9
Additional Context
Any use of
tuple
in an input (Form
, andBaseModel
as JSON) or output (BaseModel
as JSON) results in above error.The text was updated successfully, but these errors were encountered: