You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, running the above example it looks like this is supported, although the auto generated documentation misses documenting the parameters of the body.
Can this be supported in FastAPI? Our use case is that we need to support a GET method that could contain a sizable amount of data in the request. We don't really want to make this a POST method as the endpoint is only for retrieval and isn't modifying any data. Everything appears to be working for us except the auto generated documentation.
Environment
OS: [e.g. Linux / Windows / macOS]: Windows
FastAPI Version [e.g. 0.3.0]: 0.54.1
Python Version: 3.8.2
The text was updated successfully, but these errors were encountered:
I don't recall it properly, but I saw an issue talking about it... It seems like Swagger didn't support previously, but they are going to support/or are already supporting. There's an open PR related to what you're talking about, you might want to check: #1626
Yeah, that's currently supported by FastAPI in recent versions (the current is 0.62.0), but discouraged, as it's not part of the web standards. And the docs with Swagger UI will probably not show the optional GET body, but curl should work.
I have kind of the opposite issue, in that I have not defined a request body for my GET requests, but swagger is prepopulating it with:
[
"string"
]
This forces me to always remove the request body before executing, when running any API calls through the swagger UI.
I've searched for how to hide this, but the only examples I've found so far are for Java applications.
EDIT: Please disregard. This was caused by a bad type hint. Instead of some_arg: Union[None, str] = None, I had used some_arg: Union[None, list] = None.
First check
Example
Here's a self-contained, minimal, reproducible, example with my use case:
You can run and test the above code with this CURL request:
Description
FastAPI's documentation seems to suggest that GET requests with a body aren't supported: https://fastapi.tiangolo.com/tutorial/body/
However, running the above example it looks like this is supported, although the auto generated documentation misses documenting the parameters of the body.
Can this be supported in FastAPI? Our use case is that we need to support a GET method that could contain a sizable amount of data in the request. We don't really want to make this a POST method as the endpoint is only for retrieval and isn't modifying any data. Everything appears to be working for us except the auto generated documentation.
Environment
The text was updated successfully, but these errors were encountered: