我想避免在maven插件swagger codegen生成的界面中实现"default" . 例如,随着petstore招摇: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>
我使用默认的方法实现生成像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);
}
我想避免它
ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
有可能吗?
1 回答
使用"spring"语言时,"java8"参数既用于指示默认接口的使用,也用于表示Java8的一般用途,例如:使用Java8日期库时 .
相关门票:
https://github.com/swagger-api/swagger-codegen/issues/8045
https://github.com/swagger-api/swagger-codegen/issues/5614