spring-projects / spring-projects/spring-hateoas

curie _links are serialized twice for Resources collections inside a ResourceSupport class

Open
#435 0 comments 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

When you have a Resources collection as a property inside a class which extends ResourceSupport which also contains its own namespaced links the curie _links are serialised twice:

I believe this is because both the parent resource and the Resources property are treated as being at root level by the serializer and so the curie creation is doubled up.

{ "id": "200e562a-a0e8-4bab-b341-98f003341c2f", "name": "Steve", "_embedded": { "fld:somethings": [ { "id": "7e4bc574-c5d3-433e-a114-c5ffd7547222", "something": 1.2 }, { "id": "7e4bc574-c5d3-433e-a114-c5ffd7547282", "something": 2.4 } ] }, "_links": { "curies": [ { "href": "/url/rels{/rel}", "name": "fld", "templated": true } ] }, "_links": { "self": { "href": "url/200e562a-a0e8-4bab-b341-98f003341c2f" }, "fld:somethings": { "href": "url" }, "curies": [ { "href": "/url/rels{/rel}", "name": "fld", "templated": true } ] } }

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

No files or tests are named. Start by locating the serializer handling ResourceSupport and Resources collections, then reproduce the JSON shape in the issue with a namespaced parent and embedded collection. Done means the representation contains one _links object and one curies entry rather than serializing the curies twice.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.