I generated api classes with swagger-codegen-maven-plugin, and methods return ResponseEntity
@ApiOperation(value = "", nickname = "getBlockingByMdmdId", notes = "", response = BlockingDto.class, tags={ "blocklist", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = BlockingDto.class) })
@RequestMapping(value = "/v1/blocklist/{id}",
produces = "*/*",
method = RequestMethod.GET)
ResponseEntity<BlockingDto> getBlockingByMdmdId(@ApiParam(value = "", required=true) @PathVariable("mdmId") String mdmId);
How can I change return type from ResponseEntity<BlockingDto> to BlockingDto with swagger-codegen-maven-plugin?
you can use mustache template to customize your generated api interfaces.
add the following files to your project api.mustache and bodyParams.mustache in the following path src\main\resources\openapi-templates
api.mustache
bodyParams.mustache
then add the templateDirectory path to your pom.xml swagger-codegen-maven-plugin configuration as follows:-