spring-projects / spring-projects/spring-hateoas
Access HAL+JSON-_compatible_ resources that have a custom media type using Traverson
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 476
- PR merge metrics
- No merged PRs in 30d
Description
I'm using Spring 5.1.8, Spring Boot 2.1.6, and Spring HATEOAS 0.25.1.
As an example, I want to access Spring Boot Actuator resources, which are transmitted with the media type application/vnd.spring-boot.actuator.v2+json.
For that to work, I have to provide a LinkDiscoverer for that media type:
@Bean
LinkDiscoverer actuatorLinkDiscoverer() {
var halJsonPathTemplate = "$._links..['%s']..href"; // stolen from HalLinkDiscoverer
return new JsonPathLinkDiscoverer(halJsonPathTemplate, parseMediaType(ActuatorMediaType.V2_JSON));
}
The definition is basically a copy of HalLinkDiscoverer since I cannot create instances of that with a custom media type, or access the JSON Path template.
It would be nice if creating LinkDiscoverers for HAL+JSON-compatible media types were easier.
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 Traverson, LinkDiscoverer, HalLinkDiscoverer, and JsonPathLinkDiscoverer, focusing on how media types and the JSON Path template are exposed. Define a less repetitive way to create LinkDiscoverers for HAL+JSON-compatible custom media types, and verify that Spring Boot Actuator resources can be accessed through Traverson.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100