Swagger-codegen: Support for Spring RestTemplate

Created on 2 Sep 2015  ·  19Comments  ·  Source: swagger-api/swagger-codegen

I would like support for Spring RestTemplate. It will allow easy testing of the client with the MockRestServiceServer providing mock API interaction.

Feature P3 help wanted

Most helpful comment

For people arriving here, you might want to have a look at the spring-cloud FeignClient generator as the FeignClients have much more awesomeness than RestTemplate. Note that you can use it with a regular monolithic spring-boot app, you don't need to have the full microservice architecture (see the petstore sample tests for instance).

All 19 comments

@fehguy Can I work on this feature.

Sure! That would be helpful.

@kumartheashwani https://github.com/swagger-api/swagger-codegen/pull/1545 would be a good starting point to add support for another HTTP library in the Java API client. Let us know if you need any assistance. Thanks in advance.

Any progress on this issue?

If anyone wants to work on this, please reply to let us know.

For people arriving here, you might want to have a look at the spring-cloud FeignClient generator as the FeignClients have much more awesomeness than RestTemplate. Note that you can use it with a regular monolithic spring-boot app, you don't need to have the full microservice architecture (see the petstore sample tests for instance).

+1

Hi @kumartheashwani

Did you work on this ?

@RaphC I don't think anyone has working on it so feel free to contribute if you've time.

If you need help from us (the community), please reply to let us know.

Right,

I developed a client generator for spring cloud feign template. not spring rest template. @cbornet said this kind of generator already exists.

It's not exactly the same thing. Should I create a new issue ?

There is already a spring cloud feign generator. But you can help to improve it !

@cbornet I've just updated my comment to mention what you said in the prevois post :). Can you give me the name of the existing module?

Thanks

It's spring with library spring-cloud

ok. I'll try it ASAP. About the current issue, adding "rest-template" library in spring module is possible?

Anyone working on this? if None I can work/look on this one. Please let me know.

@kyeljmd I think you can.

Hi, is there any progress? We would also like to use RestTemplate.

@cbornet (This is out-of-topic, sorry), but, I cannot find any example of POM that allows me to use language spring, library spring-cloud to generate my @FeignClient annotated interface. I am using swagger-codegen-maven-plugin version 3.0.2.

When I configure it to use spring-cloud library I get the following error on mvn compile:

io.swagger.codegen.v3:swagger-codegen-maven-plugin:3.0.2:gen‌​erate failed: Unknown library: spring-cloud
[ERROR] Available libraries:
[ERROR]   spring-boot
[ERROR]   spring-mvc

I tried to look for documentation, StackOverflow and Google with no luck. Some example, link or help will be appreciated.

Was this page helpful?
0 / 5 - 0 ratings