spring-projects / spring-projects/spring-hateoas

Add support for kotlin coroutine suspend functions to WebFluxLinkBuilder

Open
#1,285 1 comment 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kotlin
Dominant language
Java
Stars
1.1k
Forks
476
PR merge metrics
No merged PRs in 30d

Description

Currently the only solution that allows HATEOAS to interoperate with suspend coroutine functions is to wrap all output into Mono and Flux (Flow seems to work for some reason too, but it's probably a bad idea to use it without understanding why it works).

In short, implement the following prototype:

fun <reified T> WebFluxLinkBuilder.linkTo(block: suspend T.() -> Any?)

I realize now there's a second problem identified here, which is that the boilerplate for methodOn can be eliminated with reified generics in Kotlin. Perhaps another task can be to add Kotlin extensions when possible?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at WebFluxLinkBuilder and inspect its existing linkTo entry points alongside the current Mono and Flux handling. Implement and validate the proposed suspend-function linkTo prototype so coroutine functions no longer need their output wrapped in Mono or Flux.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, spring
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.