OpenAPITools / OpenAPITools/openapi-generator

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

Open
#20,174 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
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();

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with OpenAPI Generator 7.10.0, the Maven configuration shown, and Spring Boot 3.4.0 using the spring-http-interface library. Inspect the generated client setup and verify that the output compiles and uses the compatible HttpServiceProxyFactory construction shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, spring, spring-boot
Domain
api, backend, build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.