Skip to content

Endpoints with multiple consuming media types not supported #71

Closed
@akiraly

Description

@akiraly

I have a webflux controller like this:

@RestController
@RequestMapping("/foo")
public class FooController {

  @PostMapping(path = "/bar/baz", consumes = "application/x.a+json", produces = MediaType.TEXT_PLAIN_VALUE)
  public String process1(@RequestBody A a) {
    return a.toString();
  }

  @PostMapping(path = "/bar/baz", consumes = "application/x.b+json", produces = MediaType.TEXT_PLAIN_VALUE)
  public String process2(@RequestBody B b) {
    return b.toString();
  }
}

Note that both java methods are bound to the same path - /foo/bar/baz and same HTTP method - POST. The only difference is in the consumed media type.

Spring Boot 2.1.7 supports this and can call the appropriate method based on the content type sent by the client.

However in case of springdoc only one of the methods are exposed. I think the Swagger UI would support multiple different media types because it has a drop down for it but currently it only has one element instead of 2.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions