Skip to content
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

Can't perform PATCH update of an entity referring a child related element with its Hal URL in Native context #1883

Closed
mathieupedreropro opened this issue Dec 6, 2022 · 2 comments
Assignees

Comments

@mathieupedreropro
Copy link

Hi Spring Hateoas team !

I think I found a bug (I initially created an issue on spring-boot project, by I was told by mhalbritter this is most likely to be an issue for hateoas.

I'm working with Spring-boot 3.0.0, that (through spring dependecy-management) pulls spring-hateoas 2.0.0 in my project. I work in a native context (builder paketobuildpacks/builder:tiny, 'BP_NATIVE_IMAGE': 'true' in my gradle bootBuildImage task)

In a very simple context, when compiling with spring boot native, I can't perform a patch 'for example) update of my entity reffering a child entity with its url identifier.

When I perform a PATH request with a body like this one:

{
  "shouldBeChecked": true,
  "name": "Amical6",
  "parent": null,
  "authority": "https://myurl/api/authorities/e52cdfb6-6f3c-4552-8ea4-e1357b5d052c"
}

I get the following errors :

in the web navigator (running the client app):

{"cause":{"cause":null,"message":"Cannot construct instance of `org.[xxx].Authority` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('https://myurl/api/authorities/e52cdfb6-6f3c-4552-8ea4-e1357b5d052c')\n at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: org.[xxx].MyObject[\"authority\"])"},"message":"Could not read payload"}

And, in my application logs :

Failed to evaluate Jackson deserialization for type [[simple type, class org.springframework.data.rest.webmvc.PersistentEntityResource]]: java.lang.NullPointerException

While, in the meantime, when run my project in a non native context (for example in my favourite IDE), I've got no problem at all.

Please find below:

Thanks a lot !

@mathieupedreropro
Copy link
Author

Hi,

After debugging myself this issue, I guess this is more likely to be related to spring data rest project. I keep the issue open here to let spring hateoas team have a look to it and confirm my guess.

Best regards,

@odrotbohm
Copy link
Member

PersistentEntityResource indeed indicates that this is coming from Spring Data REST. Going forward, please avoid creating the ticket multiple times. If we find out the issue actually has to be solved in a different project, we can move tickets. That causes less effort than having different teams re-evaluating stuff multiple times in their inboxes. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants