spring-projects / spring-projects/spring-hateoas

Allow ResourceAssembler to accept a params Map

Open
#615 1 comment 1 reaction 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

It'd be nice if ResourceAssembler toResource[s] method allowed a Map<String,?> to be passed in with the entity to support more complex link creation. This would allow for creating links nicely with linkTo(Class controller, Map parameters). E.g.

D toResource(T entity, Map<String,?> params)

Without it, it seems we either need to create an instance of the ResourceAssembler each time so that we can get the params in or post process (e.g. with a ResourceProcessor). I'm happy to submit a pull request if this is something of interest?

On a side note... is there a mailing list where such things are discussed beforehand? and... thanks for Spring HATEOAS!

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 locating ResourceAssembler's toResource and toResources methods, then inspect how linkTo(Class controller, Map parameters) is used. Check existing assembler tests before adding coverage for passing parameters with an entity; done means the parameterized overload works without requiring a new assembler instance or post-processing.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
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.