spring-hateoas
spring-hateoas copied to clipboard
Expand HAL-FORMS to handle immutable types properly regarding "readOnly" status
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.
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
HalFormsfor example? - are there any similar annotations I could take inspiration from?