OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
22.01k stars 6.6k forks source link

[BUG] Description spring generator not compatible with latest 3.4.0 GA #20174

Open davidkarlsen opened 4 days ago

davidkarlsen commented 4 days ago

Bug Report Checklist

Description

When generating code with latest maven plugin 7.10.0 it will generate non-compilable code.

openapi-generator version

7.10.0

OpenAPI declaration file content or url
 <plugin>
        <groupId>org.openapitools</groupId>
        <artifactId>openapi-generator-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <inputSpec>${project.basedir}/src/main/resources/bring/bring-postalcode-api-contract.yml</inputSpec>
              <skipValidateSpec>true</skipValidateSpec>
              <generatorName>spring</generatorName>
              <library>spring-http-interface</library>
              <apiPackage>org.mypkg.clients.bring.generated.api</apiPackage>
              <configOptions>
                <!-- see https://github.com/OpenAPITools/openapi-generator/releases/tag/v6.5.0 - conflicts with lombok -->
                <sourceFolder>src/gen/java/main</sourceFolder>
                <dateLibrary>java8</dateLibrary>
                <useTags>true</useTags>
              </configOptions>
            </configuration>
          </execution>
        </executions>
      </plugin>
Generation Details
Steps to reproduce

Use above config and use spring-boot 3.4.0. The actual openapi in question shouldn't match too much.

Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/19712

Suggest a fix
HttpServiceProxyFactory.builder().build().createClient(PostalCodeApi.class);

instead of

        HttpServiceProxyFactory factory = HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient)).build();
davidkarlsen commented 4 days ago

one can avoid this code to be generated by setting flag:

<generateSupportingFiles>false</generateSupportingFiles>