Spring Data REST - PUT request does not work properly since v.2.5.7

前端 未结 2 823
鱼传尺愫
鱼传尺愫 2020-12-16 16:26

Since version 2.5.7 Spring Data REST does not properly perform a PUT request to update resource which has associated resources

相关标签:
2条回答
  • 2020-12-16 16:37

    I agree with you that this is a bug in Spring Data REST and it should be reported.

    I have the same issue in my project, where updating an entity via PATCH request works fine, but PUT request updates only fields of the given entity, but not its associated resources.

    Why do I consider this a bug?

    • As people have correctly pointed out, PUT should be used for replacing a resource as a whole with a modified version, which suggests that it should be working, if you provide all fields for the resource (as in a POST request). However, in current Spring Data REST version, only the simple fields of an entity are updated and the associated resources are left intact which makes PUT request only "partially working" and that is definately not an expected behavior (even if it fulfills the RFC).
    • Moreover, Spring Data REST even allows you to do a partial PUT request, i.e. updating just your name field via PUT works. It does not work for the address though.
    • It means that Spring Data REST does not work exactly how the RFC specifies it (which may be for another debate), however it also does not provide a consistent usage - when updating one field works and updating other does not without any sign of an error.

    For the record, I am using Spring Data REST 2.6.3.

    0 讨论(0)
  • 2020-12-16 16:51

    Looks like the issue has already been reported as a bug: - please verify. As best as I can tell, this is the issue you are reporting above.

    Note, I am revising my previous answer to be this bug report.

    0 讨论(0)
提交回复
热议问题