tab*_*bim 5 java maven-plugin swagger-codegen
我必须从 yaml 文件生成代码,在我的 swagger maven 插件中:
<configOptions>
<java8>true</java8>
<sourceFolder>src/main/java</sourceFolder>
<interfaceOnly>true</interfaceOnly>
<dateLibrary>java8</dateLibrary>
<singleContentTypes>true</singleContentTypes>
</configOptions>
Run Code Online (Sandbox Code Playgroud)
即使它说 iinterfaceOnly>true 但是代码生成器生成一个具有默认实现的接口,如下所示:
@ApiOperation(value = "", nickname = "billetsFichiersHealthGet", notes = "Obtient l'état de santé de l'API. ", tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"),
@ApiResponse(code = 200, message = "Erreur", response = Error.class) })
@RequestMapping(value = "/bills/health",
produces = "application/json",
consumes = "",
method = RequestMethod.GET)
default ResponseEntity<Void> billetsFichiersHealthGet() {
if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) {
} else {
log.warn("ObjectMapper or HttpServletRequest not configured in default BilletsApi interface so no example is generated");
}
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
Run Code Online (Sandbox Code Playgroud)
如何禁用默认接口方法的生成,并且只在接口中定义而不是默认实现。
当我删除以下两个标签时,它会起作用
<java8>true</java8>
<dateLibrary>java8</dateLibrary>
Run Code Online (Sandbox Code Playgroud)
但是我的模型使用的是 localdatetime,所以我应该在 java8 上并且不能真正删除这两个标签
任何的想法 ?
小智 0
在 openapi 插件版本 4.1.2 中将 java8 设置为 false 但将 dateLibrary 设置为 java8 可以解决问题
<java8>false</java8>
<dateLibrary>java8</dateLibrary>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2126 次 |
| 最近记录: |