spring-projects / spring-projects/spring-hateoas
Provide better control for when to render HAL items as Collections
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 476
- PR merge metrics
- No merged PRs in 30d
Description
Now there is only the flag to enforce embedded collections for the HalResourcesSerializer but that is limiting and only apply to Resources.
Though I would run the idea by here on converting the simple flag to a plugin solution that would be used by HalResourcesSerializer and HalLinkListSerializer.
One option would be to extend the RelProvider interface with the method:
boolean enforceCollectionsResourceRelFor(Class<?> type);
And because the collection rendering would be a bit to HAL specific for the generic RelProvider interface another interface similar to CurieProvider would define this method:
boolean enforceCollectionForRel(String rel);
That would make it possible for the OptionalListJackson2Serializer and the HalEmbeddedBuilder to consult those methods per type and rel. Does this sound reasonable?
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 reading HalResourcesSerializer, HalLinkListSerializer, OptionalListJackson2Serializer, and HalEmbeddedBuilder, then inspect the RelProvider and CurieProvider interfaces. Determine how collection rendering is currently controlled and define the plugin or interface behavior for resource types and rels; done means both serializers honor the chosen per-type or per-rel policy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100