spring-projects / spring-projects/spring-hateoas

Can't use Traverson to navigate templated links produced by Spring Hateoas

Open
#579 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

process: waiting for feedback
Dominant language
Java
Stars
1.1k
Forks
476
PR merge metrics
No merged PRs in 30d

Description

I have an API being produced by Spring Hateoas with HypermediaType.HAL enabled and I'm trying to navigate the API using a client written using Traverson. Both the API and the client are using version 0.23.0.RELEASE running in Spring Boot Apps.

I'm following a hop and Traverson finds the link, for the given rel, which look like this http://localhost:3110/accounts/{customer-uuid}/{account-uuid} and gets to the single arg constructor in UriTemplate (line 54) where a matcher/regex is applied to find path variables but it doesn't find any. Further on in the execution it tries to expand the above Uri (line 193) and throws an IllegalArgumentException due to the first { char instead of substituting the parameters from the hop.

I would expect to be able to round trip Spring Hateoas library, such that the client can navigate an generated API. I've read through the guide, reference manual and a fair bit of the JavaDoc and don't think I've missed anything but if I have please consider this a bug to improve the docs.

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 with the Traverson navigation flow and the UriTemplate entry points identified at lines 54 and 193. Reproduce navigation against the HAL link containing customer-uuid and account-uuid, then verify that templated parameters are handled without the IllegalArgumentException and that the documented behavior matches the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.