swagger-maven-plugin icon indicating copy to clipboard operation
swagger-maven-plugin copied to clipboard

Bug related to endpoints with the same path but different consumes (produces)

Open achifal opened this issue 4 years ago • 4 comments

Hi, imagine there are two methods which differ by the consumes (produces) value:

@Get
@Path("/path")
@Consumes(“application/json“)
@Produces(“application/json“)
public Response methodOne(…) {…}
@Get
@Path("/path")
@Consumes(“application/xml“)
@Produces(“application/json“)
public Response methodTwo(…) {…}

In this case the resulting documentation contains either methodOne or methodTwo but not two methods at the same time.

The version of plugin I am using is 2.1.5. Is this a known issue and does it have any solution? Thanks a lot in advance!

achifal avatar Jun 10 '21 20:06 achifal

This does like a bug to me. However this logic is brought in through the Swagger library so we probably have to look into that. I’ll try to find some time to take a look at it.

langecode avatar Jun 13 '21 18:06 langecode

Hello, @langecode. Is there any news on this issue? If not, then maybe there is some workaround that comes to your mind

achifal avatar Nov 24 '21 10:11 achifal

I read https://github.com/swagger-api/swagger-editor/issues/854 that:

The Swagger/OpenAPI spec currently doesn't allow specifying such operations. The combination of verb+path uniquely identify an operation, query parameters do not affect it.

... and ditto consumes types.

tisonkun avatar Dec 22 '22 06:12 tisonkun

Here is another case in https://github.com/apache/pulsar/issues/18947. Although in another plugin, the case is the same.

If this plugin can somehow resolve the problem, I can try to make a migration XD.

tisonkun avatar Dec 22 '22 06:12 tisonkun