-
Notifications
You must be signed in to change notification settings - Fork 9.1k
OpenAPI 3.1.0 support: GET request body support with OpenAPI 3.1, swagger-ui 5.X #8682
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
Comments
Hi @Nikit123,
Yes, this is true
Yes, this is expected behavior. I'll explain further below.
Here is what OpenAPI 3.0.3 has to say about it: Here is what OpenAPI 3.1.0 has to say about it: Now if we take GET method and read what RFC7231 has to say about it: OpenAPI 3.1.0 considers RFC7231s SwaggerUI will pass your GET request as it is to the underlying HTTP client. Inside browser, the HTTP clients happens to be Fetch API. Fetch API doesn't allow to do GET requests with payloads and triggers the type error you're seeing: Best way to avoid this issue to comply with the OpenAPI 3.1.0 and RFC7231 and not use payloads for HTTP methods, which do not have semantics explicitly defined. |
…use it puts sRPM to a wrong repo - Select only right rpm repositories by a platform while processing a build task artifacts - Update built_srpm_url only for the build tasks of one platform - HTTP-method for route `get_task` is changed from GET to POST, because it sends a request's body (because swagger-api/swagger-ui#8682 & RFC7231) - Some typing is changed for better autocompleting and linting - Select and put noarch packages only among the build tasks of one platform - Create raw_refs per each existing platform, not only first platform from the list
…use it puts sRPM to a wrong repo - Select only right rpm repositories by a platform while processing a build task artifacts - Update built_srpm_url only for the build tasks of one platform - HTTP-method for route `get_task` is changed from GET to POST, because it sends a request's body (because swagger-api/swagger-ui#8682 & RFC7231) - Some typing is changed for better autocompleting and linting - Select and put noarch packages only among the build tasks of one platform - Create raw_refs per each existing platform, not only first platform from the list
…use it puts sRPM to a wrong repo - Select only right rpm repositories by a platform while processing a build task artifacts - Update built_srpm_url only for the build tasks of one platform - HTTP-method for route `get_task` is changed from GET to POST, because it sends a request's body (because swagger-api/swagger-ui#8682 & RFC7231) - Some typing is changed for better autocompleting and linting - Select and put noarch packages only among the build tasks of one platform - Create raw_refs per each existing platform, not only first platform from the list
…use it puts sRPM to a wrong repo - HTTP-method for route `get_task` is changed from GET to POST, because it sends a request's body (because swagger-api/swagger-ui#8682 & RFC7231)
Q&A (please complete the following information)
How can we help?
I am using a GET api, where I need to send a request body. I took 5.0.0-alpha.13 distribution of swagger, as I saw that it is compatible with OpenAPI 3.1. Although, when I am running it with OpenAPI 3.1, and trying to execute my GET api I still get this error - 'TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body'.
My server handles the GET request body as I have tested it with Postman and I know that OpenAPI 3.1 supports request body with GET requests. Why is swagger-ui not allowing me to do the same? Am I missing something, or this support is not in place and planned for a future release?
The text was updated successfully, but these errors were encountered: