postman-code-generators icon indicating copy to clipboard operation
postman-code-generators copied to clipboard

Java - Spring WebClient Code Generator

Open ajwad-shaikh opened this issue 5 years ago • 8 comments

Is your feature request related to a problem? Please describe. The Spring Framework is a popular application framework. While RestTemplate is usually used for RESTful communication, the library is now deprecated as per the Spring Framework 5.0 Documentation WebClient is the future-ready solution to RESTful Communication in Java Spring

Describe the solution you'd like I would like to contribute by adding a CodeGenerator for the Java Spring WebClient configuration. This will help new Spring Developers to instantly generate snippets as well as developers who are migrating from RestTemplate to WebClient to make the process smooth.

Additional context I would like to have some input from @umeshp7, @shreys7 or any of the other maintainers on how to name this in terms of language variant. Since clearly, the language is Java but the variant is WebClient and not Spring. Could we do something like what we did with JavaScript and NodeJs?

Open to inputs. Thanks!

ajwad-shaikh avatar Mar 30 '20 13:03 ajwad-shaikh

I need some input on how we might configure tests for such a generator. Unlike Java-codegens, this snippet would not compile unless in an Spring Boot Project. Would appreciate some advice from @umeshp7 or @shreys7 on how to go about this

ajwad-shaikh avatar Apr 01 '20 13:04 ajwad-shaikh

i think you can orient yourself very closely on the okhttp tests which also require the httpok library which is stored in the dependencies.zip including the spring jars the same way should work

jonnytest1 avatar Apr 01 '21 23:04 jonnytest1

@ajwad-shaikh I resonate with your idea here. I am also looking for some code-gen tool for requests in Postman which are suited for spring-boot. You mentioned WebClient by Spring, I checked the documentation, It mentions that WebClient needs a HttpClient which they already have, can we also try to include a flavor for openfeign-client doc for open-feign in this code-gen? I will gladly take up the development part for open-feign.

hp77-creator avatar Jan 19 '24 05:01 hp77-creator

Im confused by the assertion that webclient just uses httpclient: in postman for example I have a form in the request body and in postman this is clear: I'd like to see a way to automate that: it should automatically create the multi map and adds the key/value pairs...or am I missing something?

Louisa-Bieler avatar Jan 19 '24 10:01 Louisa-Bieler

Hey @Louisa-Bieler , I am sorry for the confusion, I wanted a separate support for another language + framework. I think what you are mentioning is a special use-case. Although I must say, I have not come across a use case like that, so can't help on this, maybe an example of the use case will help for clarity.

I would add to my comment for clarification. So, I am looking for support for spring-boot codegen in postman. I am thinking of using openfeign variant for doing requests rather than some default httpclient that comes built-in with java-spring boot. And I will do the development for the same. It will help me a lot.

hp77-creator avatar Jan 19 '24 14:01 hp77-creator

Hey @VShingala @akshaydeo , Is there any minimum criteria for a PR to be merged for a new codegen feature?

hp77-creator avatar Jan 20 '24 16:01 hp77-creator

@hp77-creator You can find out how to contribute here. Minimum criteria would be to have good written logic and mentioned tests in the shared page.

From what I see, both WebClient and OpenFeign has good adoption so it would be great value addition.

VShingala avatar Jan 22 '24 06:01 VShingala

Thanks @VShingala , this is helpful.

hp77-creator avatar Jan 24 '24 18:01 hp77-creator