spring-projects / spring-projects/spring-data-rest

BoundMethodParameter in AnnotatedParametersParameterAccessor must allow custom converters to be added [DATAREST-1084]

Open
#1,449 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: bug type: task
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Kollivakkam Raghavan opened DATAREST-1084 and commented

We have a requirement where a path parameter is a uuid that is a string composed of two parts. I use a DataBinder to split each part into a Java object. When the REST controller forms the link using the linkTo method it fails because it does not find a converter to convert my UUID class to a string.

The AnnotatedParametersParameterAccessor.BoundParameter class does not provide for a way to add custom converters to allow converting the object back to its string representation.

Example:

// Some comments here
@RequestMapping(path="/api/{customuuid}")
public String getFoo(@PathVariable("customuuid") MyCustomClass customUuid)
{
   // your business logic here

   // form self link here  (this fails with no converter found because DefaultConversionService is assumed)
   Link selfLink = linkTo(methodOn(MyRestController.class)
                                                          .getFoo(customUuid))
                                                          .withSelfRel();
}

No further details from DATAREST-1084

Contributor guide

Open the contributing guide

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.