spring-hateoas icon indicating copy to clipboard operation
spring-hateoas copied to clipboard

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

Open gregturn opened this issue 5 years ago • 1 comments
trafficstars

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.

gregturn avatar Apr 29 '20 15:04 gregturn

Hello @gregturn ,

Can I contribute with a pull request?

I have some questions about the hint annotation:

  • would it be dedicated to the readonly aspect (e.g. @ReadOnly(true) ) or more generic (e.g. @Hint(readonly = true) ) ?
  • would it be specific to HAL-FORMS? If yes, should the name of the annotation be prefixed by HalForms for example?
  • are there any similar annotations I could take inspiration from?

reda-alaoui avatar Nov 22 '22 21:11 reda-alaoui