From 6bfbcdfa8858ccdba98760d76e2d2a757855cc7b Mon Sep 17 00:00:00 2001 From: Noah Dietz Date: Thu, 8 Aug 2024 19:26:19 -0700 Subject: [PATCH] fix(AIP-235): allow hosting allow_missing (#1416) Allow hoisting `allow_missing` to the top level for Batch Delete. It is an allowed field for Standard Delete and it is not necessarily unique to each delete request (like `etag`), so it can be safely hoisted. Updates #1404 --- rules/aip0235/request_unknown_fields.go | 1 + rules/aip0235/request_unknown_fields_test.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rules/aip0235/request_unknown_fields.go b/rules/aip0235/request_unknown_fields.go index 0314f1059..aa2aeb299 100644 --- a/rules/aip0235/request_unknown_fields.go +++ b/rules/aip0235/request_unknown_fields.go @@ -31,6 +31,7 @@ var requestUnknownFields = &lint.FieldRule{ }, LintField: func(field *desc.FieldDescriptor) []lint.Problem { allowedFields := stringset.New( + "allow_missing", // AIP-135 "force", // AIP-135 "names", // AIP-235 "parent", // AIP-235 diff --git a/rules/aip0235/request_unknown_fields_test.go b/rules/aip0235/request_unknown_fields_test.go index 11d830b9c..fec061050 100644 --- a/rules/aip0235/request_unknown_fields_test.go +++ b/rules/aip0235/request_unknown_fields_test.go @@ -27,10 +27,11 @@ func TestRequestUnknownFields(t *testing.T) { FieldName string problems testutils.Problems }{ + {"Valid-AllowMissing", "BatchDeleteBooks", "allow_missing", testutils.Problems{}}, {"Valid-Force", "BatchDeleteBooks", "force", testutils.Problems{}}, {"Valid-Names", "BatchDeleteBooks", "names", testutils.Problems{}}, {"Valid-Parent", "BatchDeleteBooks", "parent", testutils.Problems{}}, - {"Valid-RequestID", "BatchCreateBooks", "request_id", testutils.Problems{}}, + {"Valid-RequestID", "BatchDeleteBooks", "request_id", testutils.Problems{}}, {"Valid-Requests", "BatchDeleteBooks", "requests", testutils.Problems{}}, {"Valid-ValidateOnly", "BatchDeleteBooks", "validate_only", testutils.Problems{}}, {"Invalid", "BatchDeleteBooks", "foo", testutils.Problems{{Message: "Unexpected field"}}},