spring-projects / spring-projects/spring-hateoas

Add partialExpand to UriTemplate or Link

Open
#1,361 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

partialExpand UriTemplate or Link is so commonly used ,when build Links from RepositoryEntityLinks , which is convenience don't required developer build link from scratch.
I have a kotlin's extensions to UriTemplate:

@JvmName("partialExpand")
fun UriTemplate.partialExpand(defaults: Map<String, Any>):UriTemplate {
val variables = variables.filter { it.name !in defaults }
return UriTemplate.of(expand(defaults).toUriComponentsBuilder().toUriString(), TemplateVariables(variables))
}

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 by reading UriTemplate and Link, then inspect how RepositoryEntityLinks builds links and how expand handles default variables. Compare the proposed partialExpand behavior with the existing UriTemplate API; done means callers can partially expand defaults without rebuilding links from scratch and the behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin, spring
Domain
api, backend-api-design
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.