Skip to content

Commit

Permalink
fix(AIP-151): allow batch delete an Empty response (#1136)
Browse files Browse the repository at this point in the history
Allow `BatchDelete` to use `Empty` response as is allowed in AIP-235.

Fixes #1092
  • Loading branch information
noahdietz authored Apr 13, 2023
1 parent 6ea9f20 commit 78bf96d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rules/aip0151/lro_response_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var lroResponse = &lint.MethodRule{
}

// Unless this is a Delete method, the response type should not be Empty.
if strings.HasPrefix(m.GetName(), "Delete") {
if strings.HasPrefix(m.GetName(), "Delete") || strings.HasPrefix(m.GetName(), "BatchDelete") {
return nil
}
if t := lro.GetResponseType(); t == "Empty" || t == "google.protobuf.Empty" {
Expand Down
1 change: 1 addition & 0 deletions rules/aip0151/lro_response_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func TestLROResponse(t *testing.T) {
{"InvalidEmptyString", "WriteBook", "", testutils.Problems{{Message: "must set the response type"}}},
{"InvalidGPEmpty", "WriteBook", "google.protobuf.Empty", testutils.Problems{{Message: "Empty"}}},
{"ValidGPEmptyDelete", "DeleteBook", "google.protobuf.Empty", testutils.Problems{}},
{"ValidGPEmptyDelete", "BatchDeleteBooks", "google.protobuf.Empty", testutils.Problems{}},
}
for _, test := range tests {
t.Run(test.testName, func(t *testing.T) {
Expand Down

0 comments on commit 78bf96d

Please sign in to comment.