spring-projects / spring-projects/spring-hateoas
Creating templated links when pointing to controller methods in Kotlin
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 476
- PR merge metrics
- No merged PRs in 30d
Description
Currently, if we want a templated URI that we do not manually build ourselves, we can do
linkTo(methodOn(UserController::class.java).getUser(null)).withRel("user")
This works fine with Java as we can pass null parameters to any method, but it does not work well in Kotlin, as in Kotlin we have to explicitly make our method's parameters nullable. This creates opportunities for mistakes and undermines the inherent safety of kotlin, making us do null checks just like in java instead of being able to assure that this controller method can not accept nullable parameters.
It would be nice if we had some other way to do this that isnt building the URI manually.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the linkTo(methodOn(...)) usage described in the issue and how templated controller-method links are currently created. Define an alternative that avoids nullable Kotlin controller parameters while preserving templated URI generation; done means Kotlin callers can keep non-null parameter types without manually building the URI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100