I have the following endpoint which can accept a text body from Swagger UI. How do I add another parameter to it?
<code>@ApiOperation(value = "...", consumes = MediaType.TEXT_PLAIN_VALUE)
@PostMapping(value = "handleRequest", consumes = MediaType.TEXT_PLAIN_VALUE)
@ResponseStatus(HttpStatus.OK)
public String handleRequest(@Parameter(name = "Request", description = "The body of a request", example = "...") @RequestBody String body) {
...
}
</code>
<code>@ApiOperation(value = "...", consumes = MediaType.TEXT_PLAIN_VALUE)
@PostMapping(value = "handleRequest", consumes = MediaType.TEXT_PLAIN_VALUE)
@ResponseStatus(HttpStatus.OK)
public String handleRequest(@Parameter(name = "Request", description = "The body of a request", example = "...") @RequestBody String body) {
...
}
</code>
@ApiOperation(value = "...", consumes = MediaType.TEXT_PLAIN_VALUE)
@PostMapping(value = "handleRequest", consumes = MediaType.TEXT_PLAIN_VALUE)
@ResponseStatus(HttpStatus.OK)
public String handleRequest(@Parameter(name = "Request", description = "The body of a request", example = "...") @RequestBody String body) {
...
}
I tried the following, and even though the Swagger UI is showing two text boxes, when I submitted, Spring Boot returned 400 Bad Request.
<code>@ApiOperation(value = "...", consumes = MediaType.TEXT_PLAIN_VALUE)
@PostMapping(value = "handleRequest", consumes = MediaType.TEXT_PLAIN_VALUE)
@ResponseStatus(HttpStatus.OK)
public String handleRequest(@Parameter(name = "Request", description = "The body of a request", example = "...") @RequestBody String body,
@Parameter(name = "Request2", description = "The body of a second request", example = "...") @RequestBody String body2) {
...
}
</code>
<code>@ApiOperation(value = "...", consumes = MediaType.TEXT_PLAIN_VALUE)
@PostMapping(value = "handleRequest", consumes = MediaType.TEXT_PLAIN_VALUE)
@ResponseStatus(HttpStatus.OK)
public String handleRequest(@Parameter(name = "Request", description = "The body of a request", example = "...") @RequestBody String body,
@Parameter(name = "Request2", description = "The body of a second request", example = "...") @RequestBody String body2) {
...
}
</code>
@ApiOperation(value = "...", consumes = MediaType.TEXT_PLAIN_VALUE)
@PostMapping(value = "handleRequest", consumes = MediaType.TEXT_PLAIN_VALUE)
@ResponseStatus(HttpStatus.OK)
public String handleRequest(@Parameter(name = "Request", description = "The body of a request", example = "...") @RequestBody String body,
@Parameter(name = "Request2", description = "The body of a second request", example = "...") @RequestBody String body2) {
...
}
Thanks in advance.