-
Notifications
You must be signed in to change notification settings - Fork 472
@JsonUnwrapped ignored with (embedded) CollectionModel and HAL Forms #968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
HAL-FORMS serialization copies the model’s data into a set of classes aimed at signaling Jackson on how to render. HAL just serializes the Model directly. I had not anticipated mixing model types like you did. Should make the perfect test case! Additionally this information is useful for #864. |
Hmm, when using the latest snapshot (March 31.), HAL_FORMS would not render any property in a derived RepresentationModel anymore (at least in my tests). When setting the hypermedia configuration to HAL_FORMS, the above example is now rendered as:
IMHO it is very important that the HAL_FORMS implementation renders RepresentationModels that don't use any affordances (which will be mapped on HAL Forms _templates) the very same way that the HAL implementation renders them. Today, the only way I found to get Or is there a better way using only representation models to render a result with HAL Forms like:
|
Agreed. Thought I had a guess what “fix” broke your solution. Turns out I was wrong. My fix hasn’t been merged to master yet. The point is, HAL and HAL-FORMS use very different serialization strategies so the solution isn’t straight forward. To be honest I’d like to rewrite HAL so that it’s just like HAL-FORMS offering better consistency in design. We could almost use a TCK...a batch of tests that exercise a wide range of model combinations with expected outcomes. |
Related to #970. |
A workaround for HAL_FORMS rendering representation model properties is to always use the pattern
Then all the attributes in MyModel are treated as content.
|
…tionModel and HAL Forms
…tionModel and HAL Forms
Fixed with #1269. |
…odel and HAL Forms. Original pull request: #1269.
To create REST resources with a list of embedded resources I use a pattern like
As an example:
When setting the hypermedia configuration to HAL, it is rendered as I would expect:
But when setting the hypermedia configuration to HAL_FORMS, the @JsonUnwrapped does not apply:
IMHO HAL_FORMS should render this exactly like HAL does.
The text was updated successfully, but these errors were encountered: