как в теме.Я хочу иметь разные операции в Swagger с тем же путем и HTTP-метод, но с другим типом контента.Пример: в настоящее время я использую Spring Boot в версии 2.0.5 и Swagger UI в версии 2.9.2.В моем API у меня есть два метода для регистрации пользователя:
@RequestMapping(method = RequestMethod.POST, consumes = "application/customer+json", produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Registers a new application customer", notes = "Registers a new application customer.\n", response = CustomerResource.class)
@ApiResponses(value = {
@ApiResponse(code = 201, message = "Customer successfully registered"),
@ApiResponse(code = 409, message = "User with such email is already registered"),
@ApiResponse(code = 422, message = "Customer registration request contains validation errors. Response contains detailed field validation error message"),
@ApiResponse(code = 428, message = "Database error. Application log needs to be checked")})
public ResponseEntity<UserResource> registerCustomer(
@ApiParam(value = "Model representation of the transferred data to register a new customer") @Valid @RequestBody CustomerDto customerDto,
UriComponentsBuilder uriComponentsBuilder, BindingResult bindingResult)
{
...
}
и
@RequestMapping(method = RequestMethod.POST, consumes = "application/partner+json", produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Registers a new application partner", notes = "Registers a new Easy Parking partner.\n", response = PartnerResource.class)
@ApiResponses(value = {
@ApiResponse(code = 201, message = "Partner successfully registered"),
@ApiResponse(code = 409, message = "User with such email is already registered"),
@ApiResponse(code = 422, message = "Partner registration request contains validation errors. Response contains detailed field validation error message"),
@ApiResponse(code = 428, message = "Database error. Application log needs to be checked")})
public ResponseEntity<UserResource> registerPartner(
@ApiParam(value = "Model representation of the transferred data to register a new user") @Valid @RequestBody PartnerDto partnerDto,
UriComponentsBuilder uriComponentsBuilder, BindingResult bindingResult)
{ ... }
Я хочу иметь один путь POST: / api / users для регистрации двух типов пользователей: customerи партнер.Требуются две операции, потому что атрибут партнера немного отличается от атрибута клиента.Я хочу использовать тип контента (потребляет) для выполнения разных операций, но, похоже, swagger работает только с путем и методом http.Разве это не ошибка?Есть ли способ настроить его в Spring Boot Swagger?