-
Couldn't load subscription status.
- Fork 563
DATAREST-1356 - Fix for a bug around single link PUTs introduced in 554d6cb2 #354
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
Conversation
|
@bvulaj Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
|
@bvulaj Thank you for signing the Contributor License Agreement! |
|
This is still a bug in 3.2 RC - any update on merging? |
|
Sorry, but I am having problems with this issue. Correct me if am wrong, but in line 321, the context is "check if is a single link since we are updating a property that is not a collection" so I think that the right line is
because the exception only must be throw if links is greater than 1 |
|
Is there a test case that illustrates this? We can't move forward on a single line change that flips on a "!". |
|
Sorry, I just discovered a pull request with the same proposal waiting to be approved. |
|
#364 is a duplicate of this PR. |
|
Try to have a look at git blame just before bug was introduced: https://github.com/spring-projects/spring-data-rest/blame/ce321da80715f9201a5fa12b4385264e3e861c31/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/RepositoryPropertyReferenceController.java#L317 To test this problem (I would write some, having a time to learn how to make some unit test instead of integration one):
Sample code snippet for last step: createCommentResponse = ...
userLink = ...
final String authorAssociationEndpoint = JsonPath.read(createCommentResponse.getResponseBody(), "$._links.createdBy.href");
log.info("Going to add single User to association endpoint for author (createdBy).");
this.webClient.put().uri(authorAssociationEndpoint)
.contentType(MediaType.valueOf("text/uri-list"))
.accept(MediaTypes.HAL_JSON)
.bodyValue(userLink)
.exchange().expectStatus().value(is(204));PS: If someone can point me to similar test, I will try to implement this one. |
|
if you are using spring boot 2.2.0.RELEASE, you'll have this bug. 2.1.4.RELEASE is fine. |
I have created two tests. One positive and one negative. It is in my version of pull request #364 to this bug. |
Fix for the change:
554d6cb#diff-1d7c16fe1992fef13a47fa8ab8599718L317