spring-projects / spring-projects/spring-hateoas

Expand HAL-FORMS to handle immutable types properly regarding "readOnly" status

Open
#1,282 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: mediatypes
Dominant language
Java
Stars
1.1k
Forks
476
PR merge metrics
No merged PRs in 30d

Description

It's possible to create an immutable type where you have no setters. Instead, everything is built upon either constructor calls or "@With" or whatever, and the existing code would PROBABLY misread the "readOnly" nature of those types.

We need to expand the existing set of unit tests to cover such scenarios, and then potentially entertain a "hint" annotation that could be applied to properties, constructors, and even getters/setters. That way, Spring HATEOAS can try to guess as best as it can, but in the corner cases where it can't figure it out, grant users ability to mark up their code to help HAL-FORMS render things as desired.

Related issue: #1274.

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 by reviewing the existing HAL-FORMS unit tests and related issue #1274. Define expected readOnly behavior for immutable types built through constructors or @With, then determine whether coverage alone is sufficient or a hint annotation is needed; done means the behavior is specified and tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.