删除 swagger-codegen-maven-plugin api 类中的 ResponseEntity
我使用 swagger-codegen-maven-plugin 生成了 api 类,方法返回 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);
如何使用 swagger-codegen-maven 将返回类型从 ResponseEntity
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 Mustache 模板来自定义生成的 api 接口。
将以下文件添加到您的项目 api.mustache 和 bodyParams.mustache
在以下路径中 src\main\resources\openapi-templates
api.mustache
bodyParams.mustache
然后添加pom.xml swagger-codegen-maven-plugin 配置的 templateDirectory 路径如下:-
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:-