Skip to content

Request with GET/HEAD method cannot have body #2867

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

Closed
pinoy4 opened this issue Apr 6, 2017 · 7 comments
Closed

Request with GET/HEAD method cannot have body #2867

pinoy4 opened this issue Apr 6, 2017 · 7 comments

Comments

@pinoy4
Copy link

pinoy4 commented Apr 6, 2017

I am opening this issue to address this problem.
It has already been reported in issue #2136 but that issue is closed.
From what I understand it has been closed by @fehguy stating:

Body payloads are not supported by swagger in a GET operation, and is typically not supported by any server frameworks, even though the http specification is vague about supporting them.

If I am seeing the bigger picture here this statement refers to RFC 2616, section 4.3 which was the standard until June 2014 when it was superseded by RFC 7230, section 3.3 and RFC 7231, section 4.3.1.
This has already been mentioned in the previous issue (#2136) by @ehartford but no response was given.

I am aware that the use of a body in a GET request still should be limited when designing endpoints but it should definitely NOT be prohibited. I would like to understand what the reasoning behind explicitly prohibiting this is as @webron said (again in #2136):

tbh, I don't see that happening. In 3.0, we have explicitly expressed that payloads with not work for GET, DELETE and such.

Please understand that this decision is very limiting to some of us as we are forced to choose between implementing our APIs differently from what we believe is the best way and using swagger to document it (and enable the "Try it out" feature).

Thank you very much for your time,
Francesco

@webron
Copy link
Contributor

webron commented Apr 6, 2017

@pinoy4 - we understand the pain that this may cause for some API designs, however this is not going to change. We cannot go out of bounds of what the spec allows, and it does not allow it. There are other features that people wish existed, and when they don't they can't describe their APIs using Swagger/OpenAPI. However, we will never get to the point where we cover 100% of API designs.

@webron webron closed this as completed Apr 6, 2017
@ehartford
Copy link

ehartford commented Apr 6, 2017 via email

@webron
Copy link
Contributor

webron commented Apr 6, 2017

The Swagger/OpenAPI spec forbids this.

@webron
Copy link
Contributor

webron commented Apr 6, 2017

@ehartford regardless, if you want to point me to the post in the mailing list bringing it up, I can raise it as a concern with the OpenAPI spec.

@pinoy4
Copy link
Author

pinoy4 commented Apr 7, 2017

@webron I know your goal is not to support 100% possible cases, especially since the OpenAPI spec doesn't have this goal (and I agree it should not be it's goal).
As @ehartford stated I also thought that the OpenAPI spec did not forbid this as I couldn't find it mentioned anywhere in the docs.
If you have the time to point me to it I would greatly appreciate it. Please don't see this as me not wanting to look hard enough, I really couldn't find it.

@webron
Copy link
Contributor

webron commented Apr 7, 2017

Version 2.0 wasn't clear about it, but for the moment, 3.0 is.

From the Operation Object:

The request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers.

This is not a decision we can simply flip here in the project. FWIW, out of the votes, I was the only one opposed to the change, and we go with majority (as we should). This is why I've asked @ehartford for a reference to the mailing list, as that information may be enough to turn the decision (it's technically not too late). However, as long as the decision remains, we will not support it in Swagger-UI.

@pinoy4
Copy link
Author

pinoy4 commented Apr 7, 2017

Thank's for the link. I didn't give enough attention to that table, my bad.
Well, that's it, you told me all I needed to know. Have a good one and thank's again.

@lock lock bot locked and limited conversation to collaborators Jul 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants