openapi-tools / swagger-maven-plugin

Maven plugin to activate the Swagger Core library to generate OpenAPI documentation.
MIT License
70 stars 45 forks source link

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

Open achifal opened 3 years ago

achifal commented 3 years ago

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!

langecode commented 3 years ago

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.

achifal commented 2 years ago

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

tisonkun commented 1 year ago

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 commented 1 year ago

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.