hikaku icon indicating copy to clipboard operation
hikaku copied to clipboard

Support Spring Webflux

Open Lazalatin opened this issue 5 years ago • 3 comments

Is your feature request related to one or multiple existing converters? Spring(Webflux?)Converter

Describe the solution you'd like I'd like to see Spring Webflux among the supported converters. Webflux is based on the Spring Reactive concept, which is merely used for non-blocking implementations of RESTful services. For a user it should be as easy to test his API against an openAPI spec for Spring Webflux as it is for Spring MVC.

Additional context See here for Spring Reactive: https://spring.io/reactive

Personal Comment I'd like to try to implement this feature myself, so I would be glad for any advice given :+1:

Lazalatin avatar Apr 19 '20 11:04 Lazalatin

Hi @Lazalatin,

that sounds interesting. It's really cool that you offer to do the implementation.

Since webflux has it's own artifact ("spring-webflux") I would agree with what you implied by Spring(Webflux?)Converter. I think that it should get a separate module.

For spring-webmvc I grabbed the bean which contains all the endpoints (RequestMappingHandlerMapping) and started converting the data. I'm not sure whether webflux offers a similar bean. If not then this might be very difficult.

If you start a new module, grab the hikaku-core as dependency. Create a class, e.g. SpringWebfluxConverter which implements AbstractEndpointConverter. In override val supportedFeatures you list all the features that the converter supports. For spring-webmvc I experimented a lot with different ways to declare a rest endpoint and default values in a hello-world project. For each case I created a test. I hope that this is helpful to you.

If you have any questions, don't hesitate to ask.

cc-jhr avatar Apr 21 '20 19:04 cc-jhr

Hi @cc-jhr,

thanks for your kind reply!

I managed to fiddle around with the code from the original SpringConverter and investigated more into the differencing and shared concepts between Spring MVC and Spring Reactive. Delving further into development and restarting from scratch a question came to my mind, stumbling over this particular graphic:

Spring MVC vs. Reactive Venn Diagram

As we can see, there are overlapping concepts in defining REST-Endpoints for Spring MVC and Reactive. While one could use @(Rest)Controller to define endpoints, Spring Reactive also knows concepts of RouterFunktions and HandlerFunctions providing a functional approach to handle requests to a certain service.

As I am more familiar with the controller-based approach I would like to have this implemented first. Maybe I would also cover the more functional aspects later, if I get a chance to learn them :grin:

If you have any thoughts on that, I'd like to hear them :+1:

Lazalatin avatar Apr 24 '20 09:04 Lazalatin

Hi @Lazalatin,

thank you for the update. That sounds plausible to me. Start small and with what you are more familiar with. Remember that you can track the supported cases in README.md.

cc-jhr avatar Apr 24 '20 09:04 cc-jhr