Open sinsharat opened 5 years ago
@sinsharat do you mind just correcting the code block in this issue description? The main content is in your yaml. I think you’re just missing the 3 backticks
@leggsimon Sorry i didn't understand what you meant. The only issue in this swagger code snippet is that the first method is marked as post. If i change it to get it works fine. But since GET should not have body i wanted to make it a POST request with X-HTTP-Method-Override=GET. Similarly for X-HTTP-Method-Override=PUT and X-HTTP-Method-Override=DELETE with Request method as POST for PUT and DELETE requests respoectively as the PUT and DELETE requests are blocked at many customer site deployments for security. The real issue i am talking here is the X-HTTP-Method-Override support not present. The above code snippet gives error in swagger but works actually with spring.
@sinsharat I just meant that you’re missing ```
at the end of the actual yaml code bit. If you scroll down on your code block the “### Is your feature request related to a problem?” is at the bottom. if you put ```
before that it should move that text outside the code block
I wouldn’t have thought this is something that is likely to be supported. I don’t know much about this X-HTTP-Method-Override
header but as I understand it it really just becomes an implementation detail of the internals of your API.
The only way you can interact with your API is via POST requests. The fact that internally your API requires a certain header to be set would make it a required header to your POST endpoint sure but other than that I’m not sure how you would expect this to be documented?
In my eyes it would essentially be documented the same way as a GET endpoint that accepts one of 4 types of query parameter for example. I think the only thing we could reasonably expect for this case from this project would be to have multiple examples which I think could help your case. If it would then that issue is being tracked in #2651
@leggsimon sorry for the late reply. Yes in a way i would want to support multiple POST requests for a single url distinguished by different params/headers to over come the blocking of PUT and DELETE request. I don't think this is currently supported.
@leggsimon @sinsharat Is there any workaround to make this work.
I would second this request. Consider the case where you are trying to describe multiple methods in this way. In the openapi spec you have to describe one operation and then add to it the union of all things you can do with DELETE, PUT, GET etc. This makes it very unclear what applies to what. The problem is particularly problematic when it comes to then generating a client using a code generator. What you would like to end up with is a client generated that has separate methods for GET, PUT DELETE etc, and just sets the appropriate override header. I would like the override header to be hidden and not something that the user of the client has to worry about.
Content & configuration
Swagger/OpenAPI definition: