Update Set Review API to behave in line with RFC 7231

This CL updates the implementation of PostReview to replace
all instances of raising UnprocessableEntityException
(HTTP 422) with failed Additions instead. This matches the
docs for Set Reviewer, which no longer mention 422 being a
valid response code. This also falls in line with
RFC 7231, which promotes HTTP 400s with detailed bodies
over 422s.

It also updates the documentation to be clearer about
how these API functions work.

Bug: issue 6016
Change-Id: I1adad98107ba021132293ec47c6a6da01787556e
This commit is contained in:
Aaron Gable
2017-04-25 12:03:37 -07:00
committed by David Pursehouse
parent 0beb6d9540
commit 8c650215eb
9 changed files with 234 additions and 190 deletions

View File

@@ -131,9 +131,9 @@ public interface ChangeApi {
IncludedInInfo includedIn() throws RestApiException;
void addReviewer(AddReviewerInput in) throws RestApiException;
AddReviewerResult addReviewer(AddReviewerInput in) throws RestApiException;
void addReviewer(String in) throws RestApiException;
AddReviewerResult addReviewer(String in) throws RestApiException;
SuggestedReviewersRequest suggestReviewers() throws RestApiException;
@@ -359,12 +359,12 @@ public interface ChangeApi {
}
@Override
public void addReviewer(AddReviewerInput in) {
public AddReviewerResult addReviewer(AddReviewerInput in) {
throw new NotImplementedException();
}
@Override
public void addReviewer(String in) {
public AddReviewerResult addReviewer(String in) {
throw new NotImplementedException();
}