Skip to content

[Java][Resttemplate] Normalize the RestTemplate ApiClient#14845

Merged
wing328 merged 14 commits intoOpenAPITools:masterfrom
jorgerod:feature/GH-14832-resttemplate-normalize
Mar 8, 2023
Merged

[Java][Resttemplate] Normalize the RestTemplate ApiClient#14845
wing328 merged 14 commits intoOpenAPITools:masterfrom
jorgerod:feature/GH-14832-resttemplate-normalize

Conversation

@jorgerod
Copy link
Copy Markdown
Contributor

@jorgerod jorgerod commented Mar 1, 2023

Closes: #14832

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • In case you are adding a new generator, run the following additional script :
    ./bin/utils/ensure-up-to-date.sh
    
    Commit all changed files.
  • File the PR against the correct branch: master (6.3.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
    @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10)

@wing328
Copy link
Copy Markdown
Member

wing328 commented Mar 6, 2023

@jorgerod can you please merge the latest master into your branch as that should fix the CI failure?

@jorgerod
Copy link
Copy Markdown
Contributor Author

jorgerod commented Mar 7, 2023

@jorgerod can you please merge the latest master into your branch as that should fix the CI failure?

Done

@wing328
Copy link
Copy Markdown
Member

wing328 commented Mar 8, 2023

@wing328 wing328 merged commit 9705617 into OpenAPITools:master Mar 8, 2023
@wing328 wing328 added this to the 6.5.0 milestone Mar 8, 2023
@jorgerod jorgerod deleted the feature/GH-14832-resttemplate-normalize branch March 20, 2023 15:22
@s-seidel
Copy link
Copy Markdown

s-seidel commented Apr 5, 2023

Why were the @Component annotations removed? This break the clients in our Spring Boot application. Is there another way we should be using it now?

@jorgerod
Copy link
Copy Markdown
Contributor Author

jorgerod commented Apr 5, 2023

Why were the @Component annotations removed? This break the clients in our Spring Boot application. Is there another way we should be using it now?

It has been removed because if there were several different clients you had to play with the @componentscan to avoid collisions.
Besides, it is the only Java client that carried it.

You must create a bean for the ApiClient.

@Bean
public ApiClient apiClient() {
  return new ApiClient();
}

@TheCK
Copy link
Copy Markdown
Contributor

TheCK commented Apr 5, 2023

I can see why you did this, but how is this in a minor update. This is clearly a breaking change. At least it breaks our build.

And you don't have to create a Bean for the ApiClient, since all Api implementations have lost their @Component and @Autowired annotations as well, so you have to create the correct API.

  @Bean
  public DefaultApi defaultApi(RestTemplate restTemplate) {
    return new DefaultApi(new ApiClient(restTemplate));
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Java][Resttemplate] Normalize the RestTemplate ApiClient

4 participants