spring-hateoas
spring-hateoas copied to clipboard
Add Kotlin extensions for reactive link builders
trafficstars
The MVC link builder has some great Kotlin extensions that reduce the boilerplate code quite a lot. But when using reactive, which is quite a valid use case when using Kotlin, there is no such support. Writing model assemblers for both reactive and coroutine controllers is cumbersome. This pull request would simplify model assemblers in these cases: https://github.com/spring-projects/spring-hateoas/pull/2228.
Here's a sample diff of how I could change an existing reactive model assembler with the PR:
Here's a another example for the introduced coroutine assembler:
Also, in the controller, I do not have to add
awaitSingle() after every call of the assembler.