how to avoid default method implementation in swagger codegen interface?
I resolved configuring two executions of same plugin. One with configuration to generate only the model classes (java8=true and dateLibrary=java8-localdatetime) and another to generate only the api interfaces (java=false and dateLibrary empty).
<plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.8</version>
<executions>
<execution>
<id>gera-api-model</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/openapi-spec/openapi.yaml</inputSpec>
<language>spring</language>
<generateModels>true</generateModels>
<generateApis>false</generateApis>
<configOptions>
<dateLibrary>java8-localdatetime</dateLibrary>
<java8>true</java8>
</configOptions>
</configuration>
</execution>
<execution>
<id>gera-api-interface</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/openapi-spec/openapi.yaml</inputSpec>
<language>spring</language>
<generateModels>false</generateModels>
<generateApis>true</generateApis>
<configOptions>
<java8>false</java8>
</configOptions>
</configuration>
</execution>
</executions>
<configuration>
<inputSpec>${project.basedir}/src/main/openapi-spec/openapi.yaml</inputSpec>
<language>spring</language>
<output>${project.build.directory}/generated-sources</output>
<apiPackage>br.com.acme.myproject.api</apiPackage>
<modelPackage>br.com.acme.myproject.model</modelPackage>
<library>spring-mvc</library>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelDocumentation>false</generateModelDocumentation>
<generateSupportingFiles>false</generateSupportingFiles>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<configOptions>
<bigDecimalAsString>true</bigDecimalAsString>
<serializableModel>true</serializableModel>
<reactive>false</reactive>
<interfaceOnly>true</interfaceOnly>
</configOptions>
</configuration>
<dependencies>
<dependency>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-generators</artifactId>
<version>1.0.8</version>
</dependency>
</dependencies>
</plugin>
Note: I am using the version 'v3' of the plugin.
With a "spring" language the "java8" parameter is used both to signal use of the default interface and to signal general use of Java8, e.g. when the Java8 date library is used.
Related tickets:
https://github.com/swagger-api/swagger-codegen/issues/8045
https://github.com/swagger-api/swagger-codegen/issues/5614
As per documentation the following should solve it:
<configOptions>
<skipDefaultInterface>true</skipDefaultInterface>
</configOptions>