When enabling <dateLibrary>java8</dateLibrary> in <configOptions>, default methods are created in API contract interface. Even if I set the value <java8>false</java8>.
According to the help, <java8> option produces the aforementioned default interface methods:
java8
use java8 default interface (Default: false)
I want the advantage of Java 8 types (date,...) but not default interface which is not very convenient as does not enforce to implement the API contract in controllers. I am using the <interfaceOnly>true option as I am only interested in generating the API contract and model classes.
3.0.2
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.2</version>
mvn compile
https://github.com/swagger-api/swagger-codegen/issues/8045
Enable a dedicated option for default interface independent of other Java 8 feature such as Optional class, Date library or others, or at least fix it so we can use a mix of options such as:
<useOptional>true</useOptional>
<dateLibrary>java8</dateLibrary>
<java8>false</java8> <!-- disable default interface -->
swagger-codegen 3.0.4 also outputs two java8 options:
swagger-codegen config-help -l spring
...
java8
Option. Use Java8 classes instead of third party equivalents
true - Use Java 8 classes such as Base64
false - Various third party libraries as needed
...
java8
use java8 default interface (Default: false)
...
fixed by swagger-api/swagger-codegen-generators/pull/490.
use additional properties java8=true and defaultInterfaces=false not to generate default interfaces
Most helpful comment
fixed by swagger-api/swagger-codegen-generators/pull/490.
use additional properties
java8=trueanddefaultInterfaces=falsenot to generate default interfaces