use*_*163 8 java interface maven codegen swagger
我想避免由Maven插件swagger代码生成的接口中的“默认”实现。例如,使用petstore swagger:http : //petstore.swagger.io/v2/swagger.json
我使用maven插件生成接口:
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.2.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>./src/main/resources/swagger/api.yml</inputSpec>
<language>spring</language>
<generateSupportingFiles>false</generateSupportingFiles>
<configOptions>
<interfaceOnly>true</interfaceOnly>
<java8>true</java8>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我使用默认的方法实现生成类似PetApi.java的接口:
default ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);
}
Run Code Online (Sandbox Code Playgroud)
我想避免它喜欢
ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
Run Code Online (Sandbox Code Playgroud)
有可能做到吗?
对于“spring”语言,“java8”参数用于表示默认接口的使用和Java8 的一般使用,例如当使用Java8 日期库时。
相关票证:
https : //github.com/swagger-api/swagger-codegen/issues/8045
https://github.com/swagger-api/swagger-codegen/issues/5614
| 归档时间: |
|
| 查看次数: |
2061 次 |
| 最近记录: |