From a834789e9854824310ef27f3e66b504894bd77bc Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Sun, 12 Oct 2025 12:10:04 -0700 Subject: [PATCH 1/6] field behavior should recognize aep.api.field_behavior --- go.mod | 10 ++-- go.sum | 16 +++--- rules/internal/utils/extension.go | 81 ++++++++++++++++++++++++++++--- 3 files changed, 88 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index c04e07c..bce45b0 100644 --- a/go.mod +++ b/go.mod @@ -1,17 +1,17 @@ module github.com/aep-dev/api-linter -go 1.22.0 +go 1.23 toolchain go1.23.2 require ( bitbucket.org/creachadair/stringset v0.0.14 - buf.build/gen/go/aep/api/protocolbuffers/go v1.35.1-20240717204542-6b47820e6610.1 + buf.build/gen/go/aep/api/protocolbuffers/go v1.36.10-20251011185002-1454930c8f99.1 buf.build/go/bufplugin v0.5.0 cloud.google.com/go/longrunning v0.6.1 github.com/bmatcuk/doublestar/v4 v4.6.1 github.com/gertd/go-pluralize v0.2.1 - github.com/google/go-cmp v0.6.0 + github.com/google/go-cmp v0.7.0 github.com/jhump/protoreflect v1.17.0 github.com/lithammer/dedent v1.1.0 github.com/olekukonko/tablewriter v0.0.5 @@ -19,13 +19,13 @@ require ( github.com/stoewer/go-strcase v1.3.0 google.golang.org/genproto v0.0.0-20241007155032-5fefd90f89a9 google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 - google.golang.org/protobuf v1.35.1 + google.golang.org/protobuf v1.36.10 gopkg.in/yaml.v2 v2.4.0 ) require ( buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.35.1-20240928190436-5e8abcfd7a7e.1 // indirect - buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.35.1-20240920164238-5a7b106cbb87.1 // indirect + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20240221180331-f05a6f4403ce.1 // indirect buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.35.1-20241007202033-cf42259fcbfc.1 // indirect buf.build/go/spdx v0.2.0 // indirect github.com/antlr4-go/antlr/v4 v4.13.1 // indirect diff --git a/go.sum b/go.sum index 00b4c13..6cd7b14 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,11 @@ bitbucket.org/creachadair/stringset v0.0.14 h1:t1ejQyf8utS4GZV/4fM+1gvYucggZkfhb+tMobDxYOE= bitbucket.org/creachadair/stringset v0.0.14/go.mod h1:Ej8fsr6rQvmeMDf6CCWMWGb14H9mz8kmDgPPTdiVT0w= -buf.build/gen/go/aep/api/protocolbuffers/go v1.35.1-20240717204542-6b47820e6610.1 h1:DOg1ButQlUpMAQv9vxPGJCTjhErLkOKFxXzD5ahdg50= -buf.build/gen/go/aep/api/protocolbuffers/go v1.35.1-20240717204542-6b47820e6610.1/go.mod h1:Os7Rb6DfUW3EhLGFIhlugekaIwx3Az19M5/m0WcNefE= +buf.build/gen/go/aep/api/protocolbuffers/go v1.36.10-20251011185002-1454930c8f99.1 h1:oLb4mOvnV3wNCVcbHsw4KCtQWtMbf8VURShtwM0N2A0= +buf.build/gen/go/aep/api/protocolbuffers/go v1.36.10-20251011185002-1454930c8f99.1/go.mod h1:6eR/uxhdJhB/Gk0vgKgcar7k/qKXZEArkfpF87AjF/A= buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.35.1-20240928190436-5e8abcfd7a7e.1 h1:SW2yM+ioegkQY/LIKDatCalB0Zi/9VqefPGd5VPD62o= buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.35.1-20240928190436-5e8abcfd7a7e.1/go.mod h1:rYPnjsUZ2lGpoQ/T322HWZQil9/MIZF2njP+/u/0GKg= -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.35.1-20240920164238-5a7b106cbb87.1 h1:9wP6ZZYWnF2Z0TxmII7m3XNykxnP4/w8oXeth6ekcRI= -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.35.1-20240920164238-5a7b106cbb87.1/go.mod h1:Duw/9JoXkXIydyASnLYIiufkzySThoqavOsF+IihqvM= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20240221180331-f05a6f4403ce.1 h1:19otp5rJIcsvEF2aZtpXLSunZFD6kaHnP/u107WpLQI= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20240221180331-f05a6f4403ce.1/go.mod h1:fUl8CEN/6ZAMk6bP8ahBJPUJw7rbp+j4x+wCcYi2IG4= buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.35.1-20241007202033-cf42259fcbfc.1 h1:rPi3qs3qpDIXIl5QW2IPOaYZhppRkvuVKwEZrfhpy78= buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.35.1-20241007202033-cf42259fcbfc.1/go.mod h1:4IVMTaeh4JIjBYcGFLlTorfWpKVEXDjDfHAgKTeR0Ds= buf.build/go/bufplugin v0.5.0 h1:pmK1AloAMp+4woH5hEisK9qVmDdLySzIKexUUVZLJ2Q= @@ -33,8 +33,8 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/cel-go v0.21.0 h1:cl6uW/gxN+Hy50tNYvI691+sXxioCnstFzLp2WO4GCI= github.com/google/cel-go v0.21.0/go.mod h1:rHUlWCcBKgyEk+eV03RPdZUekPp6YcJwV0FxuUksYxc= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -86,8 +86,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/rules/internal/utils/extension.go b/rules/internal/utils/extension.go index be19948..ceb6efa 100644 --- a/rules/internal/utils/extension.go +++ b/rules/internal/utils/extension.go @@ -18,6 +18,7 @@ import ( "strings" "bitbucket.org/creachadair/stringset" + aepapi "buf.build/gen/go/aep/api/protocolbuffers/go/aep/api" lrpb "cloud.google.com/go/longrunning/autogen/longrunningpb" "github.com/jhump/protoreflect/desc" apb "google.golang.org/genproto/googleapis/api/annotations" @@ -25,17 +26,52 @@ import ( ) // GetFieldBehavior returns a stringset.Set of FieldBehavior annotations for -// the given field. +// the given field. It checks both google.api.field_behavior and aep.api.field_info.field_behavior. func GetFieldBehavior(f *desc.FieldDescriptor) stringset.Set { opts := f.GetFieldOptions() + answer := stringset.New() + + // Check google.api.field_behavior extension if x := proto.GetExtension(opts, apb.E_FieldBehavior); x != nil { - answer := stringset.New() for _, fb := range x.([]apb.FieldBehavior) { answer.Add(fb.String()) } - return answer } - return nil + + // Check aep.api.field_info.field_behavior extension + if x := proto.GetExtension(opts, aepapi.E_FieldInfo); x != nil { + fieldInfo := x.(*aepapi.FieldInfo) + for _, fb := range fieldInfo.GetFieldBehavior() { + // Convert aep.api.FieldBehavior to string + // The string representation needs to match the google.api format + answer.Add(convertAEPFieldBehaviorToString(fb)) + } + } + + return answer +} + +// convertAEPFieldBehaviorToString converts aep.api.FieldBehavior to a string format +// compatible with google.api.FieldBehavior strings. +func convertAEPFieldBehaviorToString(fb aepapi.FieldBehavior) string { + switch fb { + case aepapi.FieldBehavior_FIELD_BEHAVIOR_OPTIONAL: + return "OPTIONAL" + case aepapi.FieldBehavior_FIELD_BEHAVIOR_REQUIRED: + return "REQUIRED" + case aepapi.FieldBehavior_FIELD_BEHAVIOR_OUTPUT_ONLY: + return "OUTPUT_ONLY" + case aepapi.FieldBehavior_FIELD_BEHAVIOR_INPUT_ONLY: + return "INPUT_ONLY" + case aepapi.FieldBehavior_FIELD_BEHAVIOR_IMMUTABLE: + return "IMMUTABLE" + case aepapi.FieldBehavior_FIELD_BEHAVIOR_UNORDERED_LIST: + return "UNORDERED_LIST" + case aepapi.FieldBehavior_FIELD_BEHAVIOR_NON_EMPTY_DEFAULT: + return "NON_EMPTY_DEFAULT" + default: + return fb.String() + } } // GetOperationInfo returns the google.longrunning.operation_info annotation. @@ -158,23 +194,56 @@ func GetResourceDefinitions(f *desc.FileDescriptor) []*apb.ResourceDescriptor { return nil } -// HasResourceReference returns if the field has a google.api.resource_reference annotation. +// HasResourceReference returns if the field has a google.api.resource_reference or +// aep.api.field_info.resource_reference annotation. func HasResourceReference(f *desc.FieldDescriptor) bool { if f == nil { return false } - return proto.HasExtension(f.GetFieldOptions(), apb.E_ResourceReference) + // Check google.api.resource_reference + if proto.HasExtension(f.GetFieldOptions(), apb.E_ResourceReference) { + return true + } + // Check aep.api.field_info.resource_reference + if x := proto.GetExtension(f.GetFieldOptions(), aepapi.E_FieldInfo); x != nil { + fieldInfo := x.(*aepapi.FieldInfo) + return len(fieldInfo.GetResourceReference()) > 0 + } + return false } // GetResourceReference returns the google.api.resource_reference annotation. +// If the google.api annotation is not present, it checks for aep.api.field_info.resource_reference +// and converts it to the google.api format. func GetResourceReference(f *desc.FieldDescriptor) *apb.ResourceReference { if f == nil { return nil } opts := f.GetFieldOptions() + + // Check google.api.resource_reference first if x := proto.GetExtension(opts, apb.E_ResourceReference); x != nil { return x.(*apb.ResourceReference) } + + // Check aep.api.field_info.resource_reference + if x := proto.GetExtension(opts, aepapi.E_FieldInfo); x != nil { + fieldInfo := x.(*aepapi.FieldInfo) + resourceRefs := fieldInfo.GetResourceReference() + if len(resourceRefs) > 0 { + // Convert aep.api.FieldInfo.resource_reference to google.api.ResourceReference + // Note: aep.api supports multiple resource references, but google.api only supports one + // For compatibility, we'll use the first one and set child_type for additional ones + ref := &apb.ResourceReference{} + if resourceRefs[0] == "*" { + ref.Type = "*" + } else { + ref.Type = resourceRefs[0] + } + return ref + } + } + return nil } From 541ff32cebabdf480f1714bc05fd548b76825869 Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Sun, 12 Oct 2025 12:26:55 -0700 Subject: [PATCH 2/6] all docs and tests updates --- docs/rules/0121/no-mutable-cycles.md | 2 +- docs/rules/0122/resource-id-output-only.md | 8 +-- docs/rules/0131/request-path-behavior.md | 10 +-- .../rules/0131/request-path-reference-type.md | 6 +- docs/rules/0131/request-path-reference.md | 6 +- docs/rules/0131/request-path-required.md | 6 +- docs/rules/0131/request-required-fields.md | 12 ++-- docs/rules/0132/request-parent-behavior.md | 10 +-- docs/rules/0132/request-parent-reference.md | 6 +- .../0132/request-parent-valid-reference.md | 6 +- docs/rules/0132/request-required-fields.md | 12 ++-- docs/rules/0133/request-parent-behavior.md | 16 ++--- docs/rules/0133/request-required-fields.md | 6 +- docs/rules/0133/request-resource-behavior.md | 16 ++--- docs/rules/0134/request-required-fields.md | 14 ++-- docs/rules/0135/request-force-field.md | 6 +- docs/rules/0135/request-path-behavior.md | 10 +-- docs/rules/0135/request-path-reference.md | 6 +- docs/rules/0135/request-required-fields.md | 12 ++-- docs/rules/0148/field-behavior.md | 20 +++--- docs/rules/0148/ip-address-format.md | 6 +- docs/rules/0148/uid-format.md | 6 +- docs/rules/0157/request-read-mask-field.md | 6 +- docs/rules/0158/request-skip-field.md | 6 +- .../0162/commit-request-name-behavior.md | 10 +-- docs/rules/0162/commit-request-name-field.md | 6 +- .../0162/commit-request-name-reference.md | 6 +- .../delete-revision-request-name-behavior.md | 10 +-- .../delete-revision-request-name-field.md | 6 +- .../delete-revision-request-name-reference.md | 6 +- .../0162/rollback-request-name-behavior.md | 16 ++--- .../rules/0162/rollback-request-name-field.md | 14 ++-- .../0162/rollback-request-name-reference.md | 12 ++-- .../rollback-request-revision-id-behavior.md | 16 ++--- .../rollback-request-revision-id-field.md | 14 ++-- .../tag-revision-request-name-behavior.md | 16 ++--- .../0162/tag-revision-request-name-field.md | 14 ++-- .../tag-revision-request-name-reference.md | 12 ++-- .../0162/tag-revision-request-tag-behavior.md | 16 ++--- .../0162/tag-revision-request-tag-field.md | 14 ++-- docs/rules/0164/request-name-behavior.md | 10 +-- docs/rules/0164/request-name-field.md | 2 +- docs/rules/0164/request-name-reference.md | 6 +- docs/rules/0164/request-unknown-fields.md | 6 +- docs/rules/0216/state-field-output-only.md | 4 +- .../example/bookstore/v1/bookstore.proto | 70 +++++++++---------- rules/aep0121/no_mutable_cycles_test.go | 6 +- rules/aep0122/resource_id_output_only_test.go | 6 +- rules/aep0131/request_path_behavior_test.go | 6 +- rules/aep0131/request_required_fields_test.go | 10 +-- rules/aep0132/request_parent_behavior_test.go | 6 +- rules/aep0132/request_required_fields_test.go | 10 +-- rules/aep0133/request_parent_behavior_test.go | 6 +- rules/aep0133/request_required_fields_test.go | 16 ++--- .../aep0133/request_resource_behavior_test.go | 6 +- rules/aep0134/request_required_fields_test.go | 16 ++--- rules/aep0135/request_path_behavior_test.go | 6 +- rules/aep0135/request_required_fields_test.go | 10 +-- rules/aep0148/field_behavior_test.go | 4 +- rules/aep0164/request_name_behavior_test.go | 6 +- rules/aep0216/state_field_output_only_test.go | 8 +-- rules/internal/utils/common_lints.go | 8 +-- rules/internal/utils/common_lints_test.go | 4 +- rules/internal/utils/extension.go | 6 +- rules/internal/utils/extension_test.go | 8 +-- 65 files changed, 324 insertions(+), 324 deletions(-) diff --git a/docs/rules/0121/no-mutable-cycles.md b/docs/rules/0121/no-mutable-cycles.md index b844dae..6b00433 100644 --- a/docs/rules/0121/no-mutable-cycles.md +++ b/docs/rules/0121/no-mutable-cycles.md @@ -80,7 +80,7 @@ message Author { // Correct because an OUTPUT_ONLY reference breaks the mutation cycle. string book = 2 [ (google.api.resource_reference).type = "library.googleapis.com/Book", - (google.api.field_behavior) = OUTPUT_ONLY + (aep.api.field_behavior) = FIELD_BEHAVIOR_OUTPUT_ONLY ]; } ``` diff --git a/docs/rules/0122/resource-id-output-only.md b/docs/rules/0122/resource-id-output-only.md index dba5ddf..e4f6eb2 100644 --- a/docs/rules/0122/resource-id-output-only.md +++ b/docs/rules/0122/resource-id-output-only.md @@ -30,9 +30,9 @@ message Book { pattern: "books/{book}" }; string path = 1; - // Should have `(google.api.field_behavior) = OUTPUT_ONLY`. + // Should have `(aep.api.field_behavior) = FIELD_BEHAVIOR_OUTPUT_ONLY`. string book_id = 2; - // Should have `(google.api.field_behavior) = OUTPUT_ONLY`. + // Should have `(aep.api.field_behavior) = FIELD_BEHAVIOR_OUTPUT_ONLY`. string uid = 3; } ``` @@ -47,8 +47,8 @@ message Book { pattern: "books/{book}" }; string path = 1; - string book_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + string book_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]; + string uid = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]; } ``` diff --git a/docs/rules/0131/request-path-behavior.md b/docs/rules/0131/request-path-behavior.md index 4429e46..5341c30 100644 --- a/docs/rules/0131/request-path-behavior.md +++ b/docs/rules/0131/request-path-behavior.md @@ -3,7 +3,7 @@ rule: aep: 131 name: [core, '0131', request-path-behavior] summary: | - Get RPCs should annotate the `path` field with `google.api.field_behavior`. + Get RPCs should annotate the `path` field with `aep.api.field_behavior`. permalink: /131/request-path-behavior redirect_from: - /0131/request-path-behavior @@ -12,13 +12,13 @@ redirect_from: # Get methods: Field behavior This rule enforces that all `Get` standard methods have -`google.api.field_behavior` set to `REQUIRED` on their `string path` field, as +`aep.api.field_behavior` set to `REQUIRED` on their `string path` field, as mandated in [AEP-131][]. ## Details This rule looks at any message matching `Get*Request` and complains if the -`path` field does not have a `google.api.field_behavior` annotation with a +`path` field does not have a `aep.api.field_behavior` annotation with a value of `REQUIRED`. ## Examples @@ -28,7 +28,7 @@ value of `REQUIRED`. ```proto // Incorrect. message GetBookRequest { - // The `google.api.field_behavior` annotation should also be included. + // The `aep.api.field_behavior` annotation should also be included. string path = 1 [(google.api.resource_reference) = { type: "library.googleapis.com/Book" }]; @@ -41,7 +41,7 @@ message GetBookRequest { // Correct. message GetBookRequest { string path = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } diff --git a/docs/rules/0131/request-path-reference-type.md b/docs/rules/0131/request-path-reference-type.md index 0c7bdb4..59b0bc4 100644 --- a/docs/rules/0131/request-path-reference-type.md +++ b/docs/rules/0131/request-path-reference-type.md @@ -32,7 +32,7 @@ message GetBookRequest { // The `google.api.resource_reference` annotation should be a direct `type` // reference. string path = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).child_type = "library.googleapis.com/Book" ]; } @@ -44,7 +44,7 @@ message GetBookRequest { // Correct. message GetBookRequest { string path = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -60,7 +60,7 @@ message GetBookRequest { // (-- api-linter: core::0131::request-path-reference-type=disabled // aep.dev/not-precedent: We need to do this because reasons. --) string path = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).child_type = "library.googleapis.com/Book" ]; } diff --git a/docs/rules/0131/request-path-reference.md b/docs/rules/0131/request-path-reference.md index 3e1211e..779fdd0 100644 --- a/docs/rules/0131/request-path-reference.md +++ b/docs/rules/0131/request-path-reference.md @@ -28,7 +28,7 @@ complains if it does not have a `google.api.resource_reference` annotation. // Incorrect. message GetBookRequest { // The `google.api.resource_reference` annotation should also be included. - string path = 1 [(google.api.field_behavior) = REQUIRED]; + string path = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -38,7 +38,7 @@ message GetBookRequest { // Correct. message GetBookRequest { string path = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -53,7 +53,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. message GetBookRequest { // (-- api-linter: core::0131::request-path-reference=disabled // aep.dev/not-precedent: We need to do this because reasons. --) - string path = 1 [(google.api.field_behavior) = REQUIRED]; + string path = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0131/request-path-required.md b/docs/rules/0131/request-path-required.md index 02abefc..757dfb9 100644 --- a/docs/rules/0131/request-path-required.md +++ b/docs/rules/0131/request-path-required.md @@ -26,7 +26,7 @@ the `path` field is missing. // Incorrect. message GetBookRequest { string book = 1 [ // Field path should be `path`. - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -38,7 +38,7 @@ message GetBookRequest { // Correct. message GetBookRequest { string path = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -54,7 +54,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. // aep.dev/not-precedent: This is named "book" for historical reasons. --) message GetBookRequest { string book = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } diff --git a/docs/rules/0131/request-required-fields.md b/docs/rules/0131/request-required-fields.md index 2c05bb6..7fb7f54 100644 --- a/docs/rules/0131/request-required-fields.md +++ b/docs/rules/0131/request-required-fields.md @@ -30,13 +30,13 @@ message GetBookRequest { // The path of the book to retrieve. // Format: publishers/{publisher}/books/{book} string path = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "library.googleapis.com/Book" }]; // Non-standard required field. - google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = REQUIRED]; + google.protobuf.FieldMask read_mask = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -48,12 +48,12 @@ message GetBookRequest { // The path of the book to retrieve. // Format: publishers/{publisher}/books/{book} string path = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "library.googleapis.com/Book" }]; - google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = OPTIONAL]; + google.protobuf.FieldMask read_mask = 2 [(aep.api.field_info).field_behavior = OPTIONAL]; } ``` @@ -67,7 +67,7 @@ message GetBookRequest { // The path of the book to retrieve. // Format: publishers/{publisher}/books/{book} string path = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "library.googleapis.com/Book" }]; @@ -75,7 +75,7 @@ message GetBookRequest { // (-- api-linter: core::0131::request-required-fields=disabled // aep.dev/not-precedent: We really need this field to be required because // reasons. --) - google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = REQUIRED]; + google.protobuf.FieldMask read_mask = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0132/request-parent-behavior.md b/docs/rules/0132/request-parent-behavior.md index 7a5b991..b490f1c 100644 --- a/docs/rules/0132/request-parent-behavior.md +++ b/docs/rules/0132/request-parent-behavior.md @@ -3,7 +3,7 @@ rule: aep: 132 name: [core, '0132', request-parent-behavior] summary: | - List RPCs should annotate the `parent` field with `google.api.field_behavior`. + List RPCs should annotate the `parent` field with `aep.api.field_behavior`. permalink: /132/request-parent-behavior redirect_from: - /0132/request-parent-behavior @@ -12,13 +12,13 @@ redirect_from: # List methods: Field behavior This rule enforces that all `List` standard methods have -`google.api.field_behavior` set to `REQUIRED` on their `string parent` field, +`aep.api.field_behavior` set to `REQUIRED` on their `string parent` field, as mandated in [AEP-132][]. ## Details This rule looks at any message matching `List*Request` and complains if the -`parent` field does not have a `google.api.field_behavior` annotation with a +`parent` field does not have a `aep.api.field_behavior` annotation with a value of `REQUIRED`. ## Examples @@ -28,7 +28,7 @@ value of `REQUIRED`. ```proto // Incorrect. message ListBooksRequest { - // The `google.api.field_behavior` annotation should also be included. + // The `aep.api.field_behavior` annotation should also be included. string parent = 1 [(google.api.resource_reference) = { type: "library.googleapis.com/Publisher" }]; @@ -43,7 +43,7 @@ message ListBooksRequest { // Correct. message ListBooksRequest { string parent = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Publisher" ]; int32 page_size = 2; diff --git a/docs/rules/0132/request-parent-reference.md b/docs/rules/0132/request-parent-reference.md index dee0fff..c046e11 100644 --- a/docs/rules/0132/request-parent-reference.md +++ b/docs/rules/0132/request-parent-reference.md @@ -28,7 +28,7 @@ and complains if it does not have a `google.api.resource_reference` annotation. // Incorrect. message ListBooksRequest { // The `google.api.resource_reference` annotation should also be included. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; + string parent = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; int32 page_size = 2; string page_token = 3; } @@ -40,7 +40,7 @@ message ListBooksRequest { // Correct. message ListBooksRequest { string parent = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Publisher" ]; int32 page_size = 2; @@ -57,7 +57,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. // (-- api-linter: core::0132::request-parent-reference=disabled // aep.dev/not-precedent: We need to do this because reasons. --) message ListBooksRequest { - string parent = 1 [(google.api.field_behavior) = REQUIRED]; + string parent = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0132/request-parent-valid-reference.md b/docs/rules/0132/request-parent-valid-reference.md index c3be40d..b20339c 100644 --- a/docs/rules/0132/request-parent-valid-reference.md +++ b/docs/rules/0132/request-parent-valid-reference.md @@ -32,7 +32,7 @@ message ListBooksRequest { // The `google.api.resource_reference` should not reference the resource // being listed. string parent = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; int32 page_size = 2; @@ -46,7 +46,7 @@ message ListBooksRequest { // Correct. message ListBooksRequest { string parent = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).child_type = "library.googleapis.com/Book" ]; int32 page_size = 2; @@ -64,7 +64,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. // aep.dev/not-precedent: We need to do this because reasons. --) message ListBooksRequest { string parent = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } diff --git a/docs/rules/0132/request-required-fields.md b/docs/rules/0132/request-required-fields.md index e815704..a7bc403 100644 --- a/docs/rules/0132/request-required-fields.md +++ b/docs/rules/0132/request-required-fields.md @@ -30,13 +30,13 @@ message ListBooksRequest { // The parent, which owns this collection of books. // Format: publishers/{publisher} string parent = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { child_type: "library.googleapis.com/Book" }]; // Non-standard required field. - int32 page_size = 2 [(google.api.field_behavior) = REQUIRED] + int32 page_size = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED] } ``` @@ -48,12 +48,12 @@ message ListBooksRequest { // The parent, which owns this collection of books. // Format: publishers/{publisher} string parent = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { child_type: "library.googleapis.com/Book" }]; - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL] + int32 page_size = 2 [(aep.api.field_info).field_behavior = OPTIONAL] } ``` @@ -67,7 +67,7 @@ message ListBooksRequest { // The parent, which owns this collection of books. // Format: publishers/{publisher} string parent = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { child_type: "library.googleapis.com/Book" }]; @@ -75,7 +75,7 @@ message ListBooksRequest { // (-- api-linter: core::0132::request-required-fields=disabled // aep.dev/not-precedent: We really need this field to be required because // reasons. --) - int32 page_size = 2 [(google.api.field_behavior) = REQUIRED] + int32 page_size = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED] } ``` diff --git a/docs/rules/0133/request-parent-behavior.md b/docs/rules/0133/request-parent-behavior.md index e1533ae..db7bd1f 100644 --- a/docs/rules/0133/request-parent-behavior.md +++ b/docs/rules/0133/request-parent-behavior.md @@ -3,7 +3,7 @@ rule: aep: 133 name: [core, '0133', request-parent-behavior] summary: | - Create RPCs should annotate the `parent` field with `google.api.field_behavior`. + Create RPCs should annotate the `parent` field with `aep.api.field_behavior`. permalink: /133/request-parent-behavior redirect_from: - /0133/request-parent-behavior @@ -12,13 +12,13 @@ redirect_from: # Create methods: Field behavior This rule enforces that all `Create` standard methods have -`google.api.field_behavior` set to `REQUIRED` on their `string parent` field, +`aep.api.field_behavior` set to `REQUIRED` on their `string parent` field, as mandated in [AEP-133][]. ## Details This rule looks at any message matching `Create*Request` and complains if the -`parent` field does not have a `google.api.field_behavior` annotation with a +`parent` field does not have a `aep.api.field_behavior` annotation with a value of `REQUIRED`. ## Examples @@ -28,11 +28,11 @@ value of `REQUIRED`. ```proto // Incorrect. message CreateBooksRequest { - // The `google.api.field_behavior` annotation should also be included. + // The `aep.api.field_behavior` annotation should also be included. string parent = 1 [(google.api.resource_reference) = { type: "library.googleapis.com/Publisher" }]; - Book book = 2 [(google.api.field_behavior) = REQUIRED]; + Book book = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -42,10 +42,10 @@ message CreateBooksRequest { // Correct. message CreateBooksRequest { string parent = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Publisher" ]; - Book book = 2 [(google.api.field_behavior) = REQUIRED]; + Book book = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -61,7 +61,7 @@ message CreateBooksRequest { string parent = 1 [(google.api.resource_reference) = { type: "library.googleapis.com/Publisher" }]; - Book book = 2 [(google.api.field_behavior) = REQUIRED]; + Book book = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0133/request-required-fields.md b/docs/rules/0133/request-required-fields.md index 42e51a8..c20ce5a 100644 --- a/docs/rules/0133/request-required-fields.md +++ b/docs/rules/0133/request-required-fields.md @@ -33,7 +33,7 @@ message CreateBookRequest { Book book = 2; string book_id = 3; // Non-standard required field. - string validate_only = 4 [(google.api.field_behavior) = REQUIRED]; + string validate_only = 4 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -45,7 +45,7 @@ message CreateBookRequest { string parent = 1; Book book = 2; string id = 3; - string validate_only = 4 [(google.api.field_behavior) = OPTIONAL]; + string validate_only = 4 [(aep.api.field_info).field_behavior = OPTIONAL]; } ``` @@ -63,7 +63,7 @@ message CreateBookRequest { // (-- api-linter: core::0133::request-required-fields=disabled // aep.dev/not-precedent: We really need this field to be required because // reasons. --) - string validate_only = 4 [(google.api.field_behavior) = REQUIRED]; + string validate_only = 4 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0133/request-resource-behavior.md b/docs/rules/0133/request-resource-behavior.md index c59e01b..a43e5ad 100644 --- a/docs/rules/0133/request-resource-behavior.md +++ b/docs/rules/0133/request-resource-behavior.md @@ -3,7 +3,7 @@ rule: aep: 133 name: [core, '0133', request-resource-behavior] summary: | - Create RPCs should annotate the resource field with `google.api.field_behavior`. + Create RPCs should annotate the resource field with `aep.api.field_behavior`. permalink: /133/request-resource-behavior redirect_from: - /0133/request-resource-behavior @@ -12,13 +12,13 @@ redirect_from: # Create methods: Field behavior This rule enforces that all `Create` standard methods have -`google.api.field_behavior` set to `REQUIRED` on the field representing the +`aep.api.field_behavior` set to `REQUIRED` on the field representing the resource, as mandated in [AEP-133][]. ## Details This rule looks at any message matching `Create*Request` and complains if the -resource field does not have a `google.api.field_behavior` annotation with a +resource field does not have a `aep.api.field_behavior` annotation with a value of `REQUIRED`. ## Examples @@ -29,10 +29,10 @@ value of `REQUIRED`. // Incorrect. message CreateBooksRequest { string parent = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Publisher" ]; - Book book = 2; // Should also have (google.api.field_behavior) = REQUIRED. + Book book = 2; // Should also have (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED. } ``` @@ -42,10 +42,10 @@ message CreateBooksRequest { // Correct. message CreateBooksRequest { string parent = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Publisher" ]; - Book book = 2 [(google.api.field_behavior) = REQUIRED]; + Book book = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -57,7 +57,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. ```proto message CreateBooksRequest { string parent = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Publisher" ]; diff --git a/docs/rules/0134/request-required-fields.md b/docs/rules/0134/request-required-fields.md index 83e8fda..a7f853b 100644 --- a/docs/rules/0134/request-required-fields.md +++ b/docs/rules/0134/request-required-fields.md @@ -27,9 +27,9 @@ comes across any required fields other than: ```proto // Incorrect. message UpdateBookRequest { - Book book = 1 [(google.api.field_behavior) = REQUIRED]; + Book book = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; // Non-standard required field. - bool allow_missing = 2 [(google.api.field_behavior) = REQUIRED]; + bool allow_missing = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -38,9 +38,9 @@ message UpdateBookRequest { ```proto // Correct. message UpdateBookRequest { - string path = 1 [(google.api.field_behavior) = REQUIRED]; - Book book = 2 [(google.api.field_behavior) = REQUIRED]; - bool allow_missing = 3 [(google.api.field_behavior) = OPTIONAL]; + string path = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; + Book book = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; + bool allow_missing = 3 [(aep.api.field_info).field_behavior = OPTIONAL]; } ``` @@ -51,11 +51,11 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. ```proto message UpdateBookRequest { - Book book = 1 [(google.api.field_behavior) = REQUIRED]; + Book book = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; // (-- api-linter: core::0134::request-required-fields=disabled // aep.dev/not-precedent: We really need this field to be required because // reasons. --) - bool allow_missing = 2 [(google.api.field_behavior) = REQUIRED]; + bool allow_missing = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0135/request-force-field.md b/docs/rules/0135/request-force-field.md index 897f8ed..bd8c457 100644 --- a/docs/rules/0135/request-force-field.md +++ b/docs/rules/0135/request-force-field.md @@ -26,7 +26,7 @@ field and complains if the field is not a singular `bool`. message DeletePublisherRequest { string path = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Publisher", - (google.api.field_behavior) = REQUIRED + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED ]; int32 force = 2; // Field type should be `bool`. @@ -39,7 +39,7 @@ message DeletePublisherRequest { message DeletePublisherRequest { string path = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Publisher", - (google.api.field_behavior) = REQUIRED + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED ]; bool force = 2; @@ -55,7 +55,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. message DeletePublisherRequest { string path = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Publisher", - (google.api.field_behavior) = REQUIRED + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED ]; // (-- api-linter: core::0135::request-force-field=disabled diff --git a/docs/rules/0135/request-path-behavior.md b/docs/rules/0135/request-path-behavior.md index 4b78213..9b51595 100644 --- a/docs/rules/0135/request-path-behavior.md +++ b/docs/rules/0135/request-path-behavior.md @@ -3,7 +3,7 @@ rule: aep: 135 name: [core, '0135', request-path-behavior] summary: | - Delete RPCs should annotate the `path` field with `google.api.field_behavior`. + Delete RPCs should annotate the `path` field with `aep.api.field_behavior`. permalink: /135/request-path-behavior redirect_from: - /0135/request-path-behavior @@ -12,13 +12,13 @@ redirect_from: # Delete methods: Field behavior This rule enforces that all `Delete` standard methods have -`google.api.field_behavior` set to `REQUIRED` on their `string path` field, as +`aep.api.field_behavior` set to `REQUIRED` on their `string path` field, as mandated in [AEP-135][]. ## Details This rule looks at any message matching `Delete*Request` and complains if the -`path` field does not have a `google.api.field_behavior` annotation with a +`path` field does not have a `aep.api.field_behavior` annotation with a value of `REQUIRED`. ## Examples @@ -28,7 +28,7 @@ value of `REQUIRED`. ```proto // Incorrect. message DeleteBookRequest { - // The `google.api.field_behavior` annotation should also be included. + // The `aep.api.field_behavior` annotation should also be included. string path = 1 [(google.api.resource_reference) = { type: "library.googleapis.com/Book" }]; @@ -41,7 +41,7 @@ message DeleteBookRequest { // Correct. message DeleteBookRequest { string path = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } diff --git a/docs/rules/0135/request-path-reference.md b/docs/rules/0135/request-path-reference.md index 0432c5b..4987cb2 100644 --- a/docs/rules/0135/request-path-reference.md +++ b/docs/rules/0135/request-path-reference.md @@ -28,7 +28,7 @@ and complains if it does not have a `google.api.resource_reference` annotation. // Incorrect. message DeleteBookRequest { // The `google.api.resource_reference` annotation should also be included. - string path = 1 [(google.api.field_behavior) = REQUIRED]; + string path = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -38,7 +38,7 @@ message DeleteBookRequest { // Correct. message DeleteBookRequest { string path = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -53,7 +53,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. message DeleteBookRequest { // (-- api-linter: core::0135::request-path-reference=disabled // aep.dev/not-precedent: We need to do this because reasons. --) - string path = 1 [(google.api.field_behavior) = REQUIRED]; + string path = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0135/request-required-fields.md b/docs/rules/0135/request-required-fields.md index a12df56..813a892 100644 --- a/docs/rules/0135/request-required-fields.md +++ b/docs/rules/0135/request-required-fields.md @@ -27,9 +27,9 @@ comes across any required fields other than: ```proto // Incorrect. message DeleteBookRequest { - string path = 1 [(google.api.field_behavior) = REQUIRED]; + string path = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; // Non-standard required field. - bool allow_missing = 4 [(google.api.field_behavior) = REQUIRED]; + bool allow_missing = 4 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -38,8 +38,8 @@ message DeleteBookRequest { ```proto // Correct. message DeleteBookRequest { - string path = 1 [(google.api.field_behavior) = REQUIRED]; - bool allow_missing = 4 [(google.api.field_behavior) = OPTIONAL]; + string path = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; + bool allow_missing = 4 [(aep.api.field_info).field_behavior = OPTIONAL]; } ``` @@ -50,11 +50,11 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. ```proto message DeleteBookRequest { - string path = 1 [(google.api.field_behavior) = REQUIRED]; + string path = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; // (-- api-linter: core::0135::request-required-fields=disabled // aep.dev/not-precedent: We really need this field to be required because // reasons. --) - bool allow_missing = 4 [(google.api.field_behavior) = REQUIRED]; + bool allow_missing = 4 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0148/field-behavior.md b/docs/rules/0148/field-behavior.md index c3425c8..0db214a 100644 --- a/docs/rules/0148/field-behavior.md +++ b/docs/rules/0148/field-behavior.md @@ -11,13 +11,13 @@ redirect_from: # Standard resource fields: Field behavior This rule enforces that all standard resource fields have the correct -`google.api.field_behavior`, as mandated in [AIP-148][]. +`aep.api.field_behavior`, as mandated in [AIP-148][]. ## Details This rule looks at any message with a `google.api.resource` annotation, and complains if any of the following fields does not have a -`google.api.field_behavior` annotation with a value of `OUTPUT_ONLY`: +`aep.api.field_behavior` annotation with a value of `OUTPUT_ONLY`: - `create_time` - `delete_time` @@ -38,16 +38,16 @@ message Book { string path = 1; - // The `google.api.field_behavior` annotation should be `OUTPUT_ONLY`. + // The `aep.api.field_behavior` annotation should be `OUTPUT_ONLY`. google.protobuf.Timestamp create_time = 2; - // The `google.api.field_behavior` annotation should be `OUTPUT_ONLY`. + // The `aep.api.field_behavior` annotation should be `OUTPUT_ONLY`. google.protobuf.Timestamp update_time = 3; - // The `google.api.field_behavior` annotation should be `OUTPUT_ONLY`. + // The `aep.api.field_behavior` annotation should be `OUTPUT_ONLY`. google.protobuf.Timestamp delete_time = 4; - // The `google.api.field_behavior` annotation should be `OUTPUT_ONLY`. + // The `aep.api.field_behavior` annotation should be `OUTPUT_ONLY`. string uid = 5; } ``` @@ -64,13 +64,13 @@ message Book { string path = 1; - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]; - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]; - google.protobuf.Timestamp delete_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp delete_time = 4 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]; - string uid = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + string uid = 5 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]; } ``` diff --git a/docs/rules/0148/ip-address-format.md b/docs/rules/0148/ip-address-format.md index 2048874..9211e31 100644 --- a/docs/rules/0148/ip-address-format.md +++ b/docs/rules/0148/ip-address-format.md @@ -33,7 +33,7 @@ message Book { pattern: "books/{book}" }; - string path = 1 [(google.api.field_behavior) = IDENTIFIER]; + string path = 1 [(aep.api.field_info).field_behavior = IDENTIFIER]; string ip_address = 2; // missing (google.api.field_info).format = IPV4 } ``` @@ -48,7 +48,7 @@ message Book { pattern: "books/{book}" }; - string path = 1 [(google.api.field_behavior) = IDENTIFIER]; + string path = 1 [(aep.api.field_info).field_behavior = IDENTIFIER]; string ip_address = 2 [(google.api.field_info).format = IPV4]; } ``` @@ -66,7 +66,7 @@ message Book { pattern: "books/{book}" }; - string path = 1 [(google.api.field_behavior) = IDENTIFIER]; + string path = 1 [(aep.api.field_info).field_behavior = IDENTIFIER]; // (-- api-linter: core::0148::ip-address-format=disabled // aep.dev/not-precedent: We need to do this because reasons. --) diff --git a/docs/rules/0148/uid-format.md b/docs/rules/0148/uid-format.md index 6a2ca90..d495dcd 100644 --- a/docs/rules/0148/uid-format.md +++ b/docs/rules/0148/uid-format.md @@ -31,7 +31,7 @@ message Book { pattern: "books/{book}" }; - string path = 1 [(google.api.field_behavior) = IDENTIFIER]; + string path = 1 [(aep.api.field_info).field_behavior = IDENTIFIER]; string uid = 2; // missing (google.api.field_info).format = UUID4 } ``` @@ -46,7 +46,7 @@ message Book { pattern: "books/{book}" }; - string path = 1 [(google.api.field_behavior) = IDENTIFIER]; + string path = 1 [(aep.api.field_info).field_behavior = IDENTIFIER]; string uid = 2 [(google.api.field_info).format = UUID4]; } ``` @@ -64,7 +64,7 @@ message Book { pattern: "books/{book}" }; - string path = 1 [(google.api.field_behavior) = IDENTIFIER]; + string path = 1 [(aep.api.field_info).field_behavior = IDENTIFIER]; // (-- api-linter: core::0148::uid-format=disabled // aep.dev/not-precedent: We need to do this because reasons. --) diff --git a/docs/rules/0157/request-read-mask-field.md b/docs/rules/0157/request-read-mask-field.md index 629773d..2e0455a 100644 --- a/docs/rules/0157/request-read-mask-field.md +++ b/docs/rules/0157/request-read-mask-field.md @@ -27,7 +27,7 @@ field, and complains if the field is not a singular `google.protobuf.FieldMask`. message GetBookRequest { string path = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book", - (google.api.field_behavior) = REQUIRED + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED ]; // Field type should be `google.protobuf.FieldMask`. @@ -42,7 +42,7 @@ message GetBookRequest { message GetBookRequest { string path = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book", - (google.api.field_behavior) = REQUIRED + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED ]; google.protobuf.FieldMask read_mask = 2; @@ -58,7 +58,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. message GetBookRequest { string path = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book", - (google.api.field_behavior) = REQUIRED + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED ]; // (-- api-linter: core::0157::request-read-mask-field=disabled diff --git a/docs/rules/0158/request-skip-field.md b/docs/rules/0158/request-skip-field.md index a4afd45..8696faa 100644 --- a/docs/rules/0158/request-skip-field.md +++ b/docs/rules/0158/request-skip-field.md @@ -26,7 +26,7 @@ contains a `skip` field, and complains if the field is not a singular `int32`. message ListBooksRequest { string parent = 1 [ (google.api.resource_reference).child_type = "library.googleapis.com/Book", - (google.api.field_behavior) = REQUIRED + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED ]; int32 max_page_size = 2; @@ -43,7 +43,7 @@ message ListBooksRequest { message ListBooksRequest { string parent = 1 [ (google.api.resource_reference).child_type = "library.googleapis.com/Book", - (google.api.field_behavior) = REQUIRED + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED ]; int32 max_page_size = 2; @@ -63,7 +63,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. message ListBooksRequest { string parent = 1 [ (google.api.resource_reference).child_type = "library.googleapis.com/Book", - (google.api.field_behavior) = REQUIRED + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED ]; int32 max_page_size = 2; diff --git a/docs/rules/0162/commit-request-name-behavior.md b/docs/rules/0162/commit-request-name-behavior.md index 7b54863..3153f7e 100644 --- a/docs/rules/0162/commit-request-name-behavior.md +++ b/docs/rules/0162/commit-request-name-behavior.md @@ -3,7 +3,7 @@ rule: aep: 162 name: [core, '0162', commit-request-name-behavior] summary: | - Commit requests should annotate the `name` field with `google.api.field_behavior`. + Commit requests should annotate the `name` field with `aep.api.field_behavior`. permalink: /162/commit-request-name-behavior redirect_from: - /0162/commit-request-name-behavior @@ -12,13 +12,13 @@ redirect_from: # Commit requests: Name field behavior This rule enforces that all `Commit` requests have -`google.api.field_behavior` set to `REQUIRED` on their `string name` field, as +`aep.api.field_behavior` set to `REQUIRED` on their `string name` field, as mandated in [AEP-162][]. ## Details This rule looks at any message matching `Commit*Request` and complains if the -`name` field does not have a `google.api.field_behavior` annotation with a +`name` field does not have a `aep.api.field_behavior` annotation with a value of `REQUIRED`. ## Examples @@ -28,7 +28,7 @@ value of `REQUIRED`. ```proto // Incorrect. message CommitBookRequest { - // The `google.api.field_behavior` annotation should also be included. + // The `aep.api.field_behavior` annotation should also be included. string name = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book" ]; @@ -41,7 +41,7 @@ message CommitBookRequest { // Correct. message CommitBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } diff --git a/docs/rules/0162/commit-request-name-field.md b/docs/rules/0162/commit-request-name-field.md index 4cf4e61..26d5690 100644 --- a/docs/rules/0162/commit-request-name-field.md +++ b/docs/rules/0162/commit-request-name-field.md @@ -34,7 +34,7 @@ message CommitBookRequest { message CommitBookRequest { // Field type should be `string`. bytes name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -46,7 +46,7 @@ message CommitBookRequest { // Correct. message CommitBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -63,7 +63,7 @@ message CommitBookRequest { // (-- api-linter: core::0162::commit-request-name-field=disabled // aep.dev/not-precedent: We need to do this because reasons. --) bytes name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } diff --git a/docs/rules/0162/commit-request-name-reference.md b/docs/rules/0162/commit-request-name-reference.md index 2d1e972..1678914 100644 --- a/docs/rules/0162/commit-request-name-reference.md +++ b/docs/rules/0162/commit-request-name-reference.md @@ -28,7 +28,7 @@ and complains if it does not have a `google.api.resource_reference` annotation. // Incorrect. message CommitBookRequest { // The `google.api.resource_reference` annotation should also be included. - string name = 1 [(google.api.field_behavior) = REQUIRED]; + string name = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -38,7 +38,7 @@ message CommitBookRequest { // Correct. message CommitBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -53,7 +53,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. message CommitBookRequest { // (-- api-linter: core::0162::commit-request-name-reference=disabled // aep.dev/not-precedent: We need to do this because reasons. --) - string name = 1 [(google.api.field_behavior) = REQUIRED]; + string name = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0162/delete-revision-request-name-behavior.md b/docs/rules/0162/delete-revision-request-name-behavior.md index 0cdc88a..c098170 100644 --- a/docs/rules/0162/delete-revision-request-name-behavior.md +++ b/docs/rules/0162/delete-revision-request-name-behavior.md @@ -3,7 +3,7 @@ rule: aep: 162 name: [core, '0162', delete-revision-request-name-behavior] summary: | - Delete Revision requests should annotate the `name` field with `google.api.field_behavior`. + Delete Revision requests should annotate the `name` field with `aep.api.field_behavior`. permalink: /162/delete-revision-request-name-behavior redirect_from: - /0162/delete-revision-request-name-behavior @@ -12,13 +12,13 @@ redirect_from: # Delete Revision requests: Name field behavior This rule enforces that all Delete Revision requests have -`google.api.field_behavior` set to `REQUIRED` on their `string name` field, as +`aep.api.field_behavior` set to `REQUIRED` on their `string name` field, as mandated in [AEP-162][]. ## Details This rule looks at any message matching `Delete*RevisionRequest` and complains if the -`name` field does not have a `google.api.field_behavior` annotation with a +`name` field does not have a `aep.api.field_behavior` annotation with a value of `REQUIRED`. ## Examples @@ -28,7 +28,7 @@ value of `REQUIRED`. ```proto // Incorrect. message DeleteBookRevisionRequest { - // The `google.api.field_behavior` annotation should also be included. + // The `aep.api.field_behavior` annotation should also be included. string name = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book" ]; @@ -41,7 +41,7 @@ message DeleteBookRevisionRequest { // Correct. message DeleteBookRevisionRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } diff --git a/docs/rules/0162/delete-revision-request-name-field.md b/docs/rules/0162/delete-revision-request-name-field.md index 2988e96..1bc1b70 100644 --- a/docs/rules/0162/delete-revision-request-name-field.md +++ b/docs/rules/0162/delete-revision-request-name-field.md @@ -33,7 +33,7 @@ message DeleteBookRevisionRequest {} message DeleteBookRevisionRequest { // Field type should be `string`. bytes name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -45,7 +45,7 @@ message DeleteBookRevisionRequest { // Correct. message DeleteBookRevisionRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -62,7 +62,7 @@ message DeleteBookRevisionRequest { // (-- api-linter: core::0162::delete-revision-request-name-field=disabled // aep.dev/not-precedent: We need to do this because reasons. --) bytes name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } diff --git a/docs/rules/0162/delete-revision-request-name-reference.md b/docs/rules/0162/delete-revision-request-name-reference.md index a4d41d0..f241cbb 100644 --- a/docs/rules/0162/delete-revision-request-name-reference.md +++ b/docs/rules/0162/delete-revision-request-name-reference.md @@ -28,7 +28,7 @@ and complains if it does not have a `google.api.resource_reference` annotation. // Incorrect. message DeleteBookRevisionRequest { // The `google.api.resource_reference` annotation should also be included. - string name = 1 [(google.api.field_behavior) = REQUIRED]; + string name = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -38,7 +38,7 @@ message DeleteBookRevisionRequest { // Correct. message DeleteBookRevisionRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -53,7 +53,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. message DeleteBookRevisionRequest { // (-- api-linter: core::0162::delete-revision-request-name-reference=disabled // aep.dev/not-precedent: We need to do this because reasons. --) - string name = 1 [(google.api.field_behavior) = REQUIRED]; + string name = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0162/rollback-request-name-behavior.md b/docs/rules/0162/rollback-request-name-behavior.md index 98154a5..ef47223 100644 --- a/docs/rules/0162/rollback-request-name-behavior.md +++ b/docs/rules/0162/rollback-request-name-behavior.md @@ -3,7 +3,7 @@ rule: aep: 162 name: [core, '0162', rollback-request-name-behavior] summary: | - Rollback requests should annotate the `name` field with `google.api.field_behavior`. + Rollback requests should annotate the `name` field with `aep.api.field_behavior`. permalink: /162/rollback-request-name-behavior redirect_from: - /0162/rollback-request-name-behavior @@ -12,13 +12,13 @@ redirect_from: # Rollback requests: Name field behavior This rule enforces that all `Rollback` requests have -`google.api.field_behavior` set to `REQUIRED` on their `string name` field, as +`aep.api.field_behavior` set to `REQUIRED` on their `string name` field, as mandated in [AEP-162][]. ## Details This rule looks at any message matching `Rollback*Request` and complains if the -`name` field does not have a `google.api.field_behavior` annotation with a +`name` field does not have a `aep.api.field_behavior` annotation with a value of `REQUIRED`. ## Examples @@ -28,12 +28,12 @@ value of `REQUIRED`. ```proto // Incorrect. message RollbackBookRequest { - // The `google.api.field_behavior` annotation should also be included. + // The `aep.api.field_behavior` annotation should also be included. string name = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + string revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -43,11 +43,11 @@ message RollbackBookRequest { // Correct. message RollbackBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + string revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -64,7 +64,7 @@ message RollbackBookRequest { (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + string revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0162/rollback-request-name-field.md b/docs/rules/0162/rollback-request-name-field.md index f6ed9b2..1637559 100644 --- a/docs/rules/0162/rollback-request-name-field.md +++ b/docs/rules/0162/rollback-request-name-field.md @@ -26,7 +26,7 @@ either the `name` field is missing or it has any type other than `string`. // Incorrect. // Should include a `string name` field. message RollbackBookRequest { - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + string revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -35,11 +35,11 @@ message RollbackBookRequest { message RollbackBookRequest { // Field type should be `string`. bytes name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + string revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -49,11 +49,11 @@ message RollbackBookRequest { // Correct. message RollbackBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + string revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -68,11 +68,11 @@ message RollbackBookRequest { // (-- api-linter: core::0162::rollback-request-name-field=disabled // aep.dev/not-precedent: We need to do this because reasons. --) bytes name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + string revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0162/rollback-request-name-reference.md b/docs/rules/0162/rollback-request-name-reference.md index a547042..9155ee7 100644 --- a/docs/rules/0162/rollback-request-name-reference.md +++ b/docs/rules/0162/rollback-request-name-reference.md @@ -28,9 +28,9 @@ and complains if it does not have a `google.api.resource_reference` annotation. // Incorrect. message RollbackBookRequest { // The `google.api.resource_reference` annotation should also be included. - string name = 1 [(google.api.field_behavior) = REQUIRED]; + string name = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + string revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -40,11 +40,11 @@ message RollbackBookRequest { // Correct. message RollbackBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + string revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -57,9 +57,9 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. message RollbackBookRequest { // (-- api-linter: core::0162::rollback-request-name-reference=disabled // aep.dev/not-precedent: We need to do this because reasons. --) - string name = 1 [(google.api.field_behavior) = REQUIRED]; + string name = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + string revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0162/rollback-request-revision-id-behavior.md b/docs/rules/0162/rollback-request-revision-id-behavior.md index 781b0cf..18057f2 100644 --- a/docs/rules/0162/rollback-request-revision-id-behavior.md +++ b/docs/rules/0162/rollback-request-revision-id-behavior.md @@ -3,7 +3,7 @@ rule: aep: 162 name: [core, '0162', rollback-request-revision-id-behavior] summary: | - Rollback requests should annotate the `revision_id` field with `google.api.field_behavior`. + Rollback requests should annotate the `revision_id` field with `aep.api.field_behavior`. permalink: /162/rollback-request-revision-id-behavior redirect_from: - /0162/rollback-request-revision-id-behavior @@ -12,13 +12,13 @@ redirect_from: # Rollback requests: Revision ID field behavior This rule enforces that all `Rollback` requests have -`google.api.field_behavior` set to `REQUIRED` on their `string revision_id` field, as +`aep.api.field_behavior` set to `REQUIRED` on their `string revision_id` field, as mandated in [AEP-162][]. ## Details This rule looks at any message matching `Rollback*Request` and complains if the -`revision_id` field does not have a `google.api.field_behavior` annotation with a +`revision_id` field does not have a `aep.api.field_behavior` annotation with a value of `REQUIRED`. ## Examples @@ -29,11 +29,11 @@ value of `REQUIRED`. // Incorrect. message RollbackBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - // The `google.api.field_behavior` annotation should be included. + // The `aep.api.field_behavior` annotation should be included. string revision_id = 2; } ``` @@ -44,11 +44,11 @@ message RollbackBookRequest { // Correct. message RollbackBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + string revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -60,7 +60,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. ```proto message RollbackBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; diff --git a/docs/rules/0162/rollback-request-revision-id-field.md b/docs/rules/0162/rollback-request-revision-id-field.md index 4eb5a35..7e6c01a 100644 --- a/docs/rules/0162/rollback-request-revision-id-field.md +++ b/docs/rules/0162/rollback-request-revision-id-field.md @@ -27,7 +27,7 @@ either the `revision_id` field is missing or it has any type other than `string` // Should include a `string revision_id` field. message RollbackBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -37,12 +37,12 @@ message RollbackBookRequest { // Incorrect. message RollbackBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; // Field type should be `string`. - bytes revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + bytes revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -52,11 +52,11 @@ message RollbackBookRequest { // Correct. message RollbackBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + string revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -69,13 +69,13 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. ```proto message RollbackBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; // (-- api-linter: core::0162::rollback-request-revision-id-field=disabled // aep.dev/not-precedent: We need to do this because reasons. --) - bytes revision_id = 2 [(google.api.field_behavior) = REQUIRED]; + bytes revision_id = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0162/tag-revision-request-name-behavior.md b/docs/rules/0162/tag-revision-request-name-behavior.md index 470dc1b..c2787a2 100644 --- a/docs/rules/0162/tag-revision-request-name-behavior.md +++ b/docs/rules/0162/tag-revision-request-name-behavior.md @@ -3,7 +3,7 @@ rule: aep: 162 name: [core, '0162', tag-revision-request-name-behavior] summary: | - Tag Revision requests should annotate the `name` field with `google.api.field_behavior`. + Tag Revision requests should annotate the `name` field with `aep.api.field_behavior`. permalink: /162/tag-revision-request-name-behavior redirect_from: - /0162/tag-revision-request-name-behavior @@ -12,13 +12,13 @@ redirect_from: # Tag Revision requests: Name field behavior This rule enforces that all Tag Revision requests have -`google.api.field_behavior` set to `REQUIRED` on their `string name` field, as +`aep.api.field_behavior` set to `REQUIRED` on their `string name` field, as mandated in [AEP-162][]. ## Details This rule looks at any message matching `Tag*RevisionRequest` and complains if the -`name` field does not have a `google.api.field_behavior` annotation with a +`name` field does not have a `aep.api.field_behavior` annotation with a value of `REQUIRED`. ## Examples @@ -28,12 +28,12 @@ value of `REQUIRED`. ```proto // Incorrect. message TagBookRevisionRequest { - // The `google.api.field_behavior` annotation should also be included. + // The `aep.api.field_behavior` annotation should also be included. string name = 1 [ (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string tag = 2 [(google.api.field_behavior) = REQUIRED]; + string tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -43,11 +43,11 @@ message TagBookRevisionRequest { // Correct. message TagBookRevisionRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string tag = 2 [(google.api.field_behavior) = REQUIRED]; + string tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -64,7 +64,7 @@ message TagBookRevisionRequest { (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string tag = 2 [(google.api.field_behavior) = REQUIRED]; + string tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0162/tag-revision-request-name-field.md b/docs/rules/0162/tag-revision-request-name-field.md index ec5996d..2e10882 100644 --- a/docs/rules/0162/tag-revision-request-name-field.md +++ b/docs/rules/0162/tag-revision-request-name-field.md @@ -26,7 +26,7 @@ either the `name` field is missing or it has any type other than `string`. // Incorrect. // Should include a `string name` field. message TagBookRevisionRequest { - string tag = 2 [(google.api.field_behavior) = REQUIRED]; + string tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -35,11 +35,11 @@ message TagBookRevisionRequest { message TagBookRevisionRequest { // Field type should be `string`. bytes name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string tag = 2 [(google.api.field_behavior) = REQUIRED]; + string tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -49,11 +49,11 @@ message TagBookRevisionRequest { // Correct. message TagBookRevisionRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string tag = 2 [(google.api.field_behavior) = REQUIRED]; + string tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -68,11 +68,11 @@ message TagBookRevisionRequest { // (-- api-linter: core::0162::tag-revision-request-name-field=disabled // aep.dev/not-precedent: We need to do this because reasons. --) bytes name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string tag = 2 [(google.api.field_behavior) = REQUIRED]; + string tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0162/tag-revision-request-name-reference.md b/docs/rules/0162/tag-revision-request-name-reference.md index 47b8ccd..f6665c1 100644 --- a/docs/rules/0162/tag-revision-request-name-reference.md +++ b/docs/rules/0162/tag-revision-request-name-reference.md @@ -28,9 +28,9 @@ and complains if it does not have a `google.api.resource_reference` annotation. // Incorrect. message TagBookRevisionRequest { // The `google.api.resource_reference` annotation should also be included. - string name = 1 [(google.api.field_behavior) = REQUIRED]; + string name = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; - string tag = 2 [(google.api.field_behavior) = REQUIRED]; + string tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -40,11 +40,11 @@ message TagBookRevisionRequest { // Correct. message TagBookRevisionRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string tag = 2 [(google.api.field_behavior) = REQUIRED]; + string tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -57,9 +57,9 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. message TagBookRevisionRequest { // (-- api-linter: core::0162::tag-revision-request-name-reference=disabled // aep.dev/not-precedent: We need to do this because reasons. --) - string name = 1 [(google.api.field_behavior) = REQUIRED]; + string name = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; - string tag = 2 [(google.api.field_behavior) = REQUIRED]; + string tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0162/tag-revision-request-tag-behavior.md b/docs/rules/0162/tag-revision-request-tag-behavior.md index 30442cc..eecfe33 100644 --- a/docs/rules/0162/tag-revision-request-tag-behavior.md +++ b/docs/rules/0162/tag-revision-request-tag-behavior.md @@ -3,7 +3,7 @@ rule: aep: 162 name: [core, '0162', tag-revision-request-tag-behavior] summary: | - Tag Revision requests should annotate the `tag` field with `google.api.field_behavior`. + Tag Revision requests should annotate the `tag` field with `aep.api.field_behavior`. permalink: /162/tag-revision-request-tag-behavior redirect_from: - /0162/tag-revision-request-tag-behavior @@ -12,13 +12,13 @@ redirect_from: # Tag Revision requests: Tag field behavior This rule enforces that all Tag Revision requests have -`google.api.field_behavior` set to `REQUIRED` on their `string tag` field, as +`aep.api.field_behavior` set to `REQUIRED` on their `string tag` field, as mandated in [AEP-162][]. ## Details This rule looks at any message matching `Tag*RevisionRequest` and complains if the -`tag` field does not have a `google.api.field_behavior` annotation with a +`tag` field does not have a `aep.api.field_behavior` annotation with a value of `REQUIRED`. ## Examples @@ -29,11 +29,11 @@ value of `REQUIRED`. // Incorrect. message TagBookRevisionRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - // The `google.api.field_behavior` annotation should be included. + // The `aep.api.field_behavior` annotation should be included. string tag = 2; } ``` @@ -44,11 +44,11 @@ message TagBookRevisionRequest { // Correct. message TagBookRevisionRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string tag = 2 [(google.api.field_behavior) = REQUIRED]; + string tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -60,7 +60,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. ```proto message TagBookRevisionRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; diff --git a/docs/rules/0162/tag-revision-request-tag-field.md b/docs/rules/0162/tag-revision-request-tag-field.md index 9aae962..94deb8b 100644 --- a/docs/rules/0162/tag-revision-request-tag-field.md +++ b/docs/rules/0162/tag-revision-request-tag-field.md @@ -27,7 +27,7 @@ either the `tag` field is missing or it has any type other than `string`. // Should include a `string tag` field. message TagBookRevisionRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -37,12 +37,12 @@ message TagBookRevisionRequest { // Incorrect. message TagBookRevisionRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; // Field type should be `string`. - bytes tag = 2 [(google.api.field_behavior) = REQUIRED]; + bytes tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -52,11 +52,11 @@ message TagBookRevisionRequest { // Correct. message TagBookRevisionRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; - string tag = 2 [(google.api.field_behavior) = REQUIRED]; + string tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -69,13 +69,13 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. ```proto message TagBookRevisionRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; // (-- api-linter: core::0162::tag-revision-request-tag-field=disabled // aep.dev/not-precedent: We need to do this because reasons. --) - bytes tag = 2 [(google.api.field_behavior) = REQUIRED]; + bytes tag = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0164/request-name-behavior.md b/docs/rules/0164/request-name-behavior.md index 950d89b..3fd915d 100644 --- a/docs/rules/0164/request-name-behavior.md +++ b/docs/rules/0164/request-name-behavior.md @@ -3,7 +3,7 @@ rule: aep: 164 name: [core, '0164', request-name-behavior] summary: | - Undelete RPCs should annotate the `name` field with `google.api.field_behavior`. + Undelete RPCs should annotate the `name` field with `aep.api.field_behavior`. permalink: /164/request-name-behavior redirect_from: - /0164/request-name-behavior @@ -12,13 +12,13 @@ redirect_from: # Undelete methods: Field behavior This rule enforces that all `Undelete` methods have -`google.api.field_behavior` set to `REQUIRED` on their `string name` field, as +`aep.api.field_behavior` set to `REQUIRED` on their `string name` field, as mandated in [AEP-164][]. ## Details This rule looks at any message matching `Undelete*Request` and complains if the -`name` field does not have a `google.api.field_behavior` annotation with a +`name` field does not have a `aep.api.field_behavior` annotation with a value of `REQUIRED`. ## Examples @@ -28,7 +28,7 @@ value of `REQUIRED`. ```proto // Incorrect. message UndeleteBookRequest { - // The `google.api.field_behavior` annotation should also be included. + // The `aep.api.field_behavior` annotation should also be included. string name = 1 [(google.api.resource_reference) = { type: "library.googleapis.com/Book" }]; @@ -41,7 +41,7 @@ message UndeleteBookRequest { // Correct. message UndeleteBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } diff --git a/docs/rules/0164/request-name-field.md b/docs/rules/0164/request-name-field.md index ea8cb52..4e86f82 100644 --- a/docs/rules/0164/request-name-field.md +++ b/docs/rules/0164/request-name-field.md @@ -42,7 +42,7 @@ message UndeleteBookRequest { // Correct. message UndeleteBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } diff --git a/docs/rules/0164/request-name-reference.md b/docs/rules/0164/request-name-reference.md index c389927..557f6ed 100644 --- a/docs/rules/0164/request-name-reference.md +++ b/docs/rules/0164/request-name-reference.md @@ -28,7 +28,7 @@ and complains if it does not have a `google.api.resource_reference` annotation. // Incorrect. message UndeleteBookRequest { // The `google.api.resource_reference` annotation should also be included. - string name = 1 [(google.api.field_behavior) = REQUIRED]; + string name = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` @@ -38,7 +38,7 @@ message UndeleteBookRequest { // Correct. message UndeleteBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book" ]; } @@ -53,7 +53,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. message UndeleteBookRequest { // (-- api-linter: core::0164::request-name-reference=disabled // aep.dev/not-precedent: We need to do this because reasons. --) - string name = 1 [(google.api.field_behavior) = REQUIRED]; + string name = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } ``` diff --git a/docs/rules/0164/request-unknown-fields.md b/docs/rules/0164/request-unknown-fields.md index fc3d19a..a5460a9 100644 --- a/docs/rules/0164/request-unknown-fields.md +++ b/docs/rules/0164/request-unknown-fields.md @@ -31,7 +31,7 @@ comes across any fields other than: // Incorrect. message UndeleteBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book", ]; string library_id = 2; // Non-standard field. @@ -44,7 +44,7 @@ message UndeleteBookRequest { // Correct. message UndeleteBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book", ]; } @@ -58,7 +58,7 @@ Remember to also include an [aep.dev/not-precedent][] comment explaining why. ```proto message UndeleteBookRequest { string name = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference).type = "library.googleapis.com/Book", ]; diff --git a/docs/rules/0216/state-field-output-only.md b/docs/rules/0216/state-field-output-only.md index 7cd2250..2f60f7d 100644 --- a/docs/rules/0216/state-field-output-only.md +++ b/docs/rules/0216/state-field-output-only.md @@ -17,7 +17,7 @@ are marked as `OUTPUT_ONLY`, as mandated in [AEP-216][]. This rule iterates over message fields that have an `enum` type, and the type name ends with `State`. Each field should have the annotation -`[(google.api.field_behavior) = OUTPUT_ONLY]`. +`[(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]`. Note that the field name is ignored for the purposes of this rule. @@ -53,7 +53,7 @@ enum State { STATE_UNSPECIFIED = 0; } -State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; +State state = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]; ``` ## Disabling diff --git a/example/proto/example/bookstore/v1/bookstore.proto b/example/proto/example/bookstore/v1/bookstore.proto index da4801a..a803775 100644 --- a/example/proto/example/bookstore/v1/bookstore.proto +++ b/example/proto/example/bookstore/v1/bookstore.proto @@ -6,7 +6,7 @@ import "google/api/annotations.proto"; import "google/api/client.proto"; -import "google/api/field_behavior.proto"; +import "aep/api/field_info.proto"; import "google/api/resource.proto"; @@ -195,13 +195,13 @@ message Book { repeated Author author = 5; // Field for isbn. - repeated string isbn = 1 [(google.api.field_behavior) = REQUIRED]; + repeated string isbn = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; // Field for price. - float price = 2 [(google.api.field_behavior) = REQUIRED]; + float price = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; // Field for published. - bool published = 3 [(google.api.field_behavior) = REQUIRED]; + bool published = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; // Field for edition. int32 edition = 4; @@ -222,7 +222,7 @@ message BookEdition { }; // Field for displayname. - string displayname = 1 [(google.api.field_behavior) = REQUIRED]; + string displayname = 1 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; // Field for path. string path = 10018; @@ -261,7 +261,7 @@ message Publisher { message CreateBookRequest { // A field for the parent of book string parent = 10013 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { } ]; @@ -269,14 +269,14 @@ message CreateBookRequest { string id = 10014; // The resource to perform the operation on. - Book book = 10015 [(google.api.field_behavior) = REQUIRED]; + Book book = 10015 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } // Request message for the Getbook method message GetBookRequest { // The globally unique identifier for the resource string path = 10018 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "bookstore.example.com/book" } ]; } @@ -285,12 +285,12 @@ message GetBookRequest { message UpdateBookRequest { // The globally unique identifier for the resource string path = 10018 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "bookstore.example.com/book" } ]; // The resource to perform the operation on. - Book book = 10015 [(google.api.field_behavior) = REQUIRED]; + Book book = 10015 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; // The update mask for the resource google.protobuf.FieldMask update_mask = 10012; @@ -300,19 +300,19 @@ message UpdateBookRequest { message DeleteBookRequest { // The globally unique identifier for the resource string path = 10018 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "bookstore.example.com/book" } ]; // If true, the resource will be deleted, even if children still exist. - bool force = 10020 [(google.api.field_behavior) = OPTIONAL]; + bool force = 10020 [(aep.api.field_info).field_behavior = OPTIONAL]; } // Request message for the Listbook method message ListBooksRequest { // A field for the parent of book string parent = 10013 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { } ]; @@ -339,19 +339,19 @@ message ListBooksResponse { message ApplyBookRequest { // The globally unique identifier for the resource string path = 10018 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "bookstore.example.com/book" } ]; // The resource to perform the operation on. - Book book = 10015 [(google.api.field_behavior) = REQUIRED]; + Book book = 10015 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } // Request message for the archive method message ArchiveBookRequest { // The globally unique identifier for the resource string path = 10018 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "bookstore.example.com/book" } ]; } @@ -366,7 +366,7 @@ message ArchiveBookResponse { message CreateBookEditionRequest { // A field for the parent of book-edition string parent = 10013 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { } ]; @@ -374,14 +374,14 @@ message CreateBookEditionRequest { string id = 10014; // The resource to perform the operation on. - BookEdition book_edition = 10015 [(google.api.field_behavior) = REQUIRED]; + BookEdition book_edition = 10015 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } // Request message for the Getbook-edition method message GetBookEditionRequest { // The globally unique identifier for the resource string path = 10018 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "bookstore.example.com/book-edition" } ]; } @@ -390,7 +390,7 @@ message GetBookEditionRequest { message DeleteBookEditionRequest { // The globally unique identifier for the resource string path = 10018 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "bookstore.example.com/book-edition" } ]; } @@ -399,7 +399,7 @@ message DeleteBookEditionRequest { message ListBookEditionsRequest { // A field for the parent of book-edition string parent = 10013 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { } ]; @@ -423,7 +423,7 @@ message ListBookEditionsResponse { message CreateIsbnRequest { // A field for the parent of isbn string parent = 10013 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { } ]; @@ -431,14 +431,14 @@ message CreateIsbnRequest { string id = 10014; // The resource to perform the operation on. - Isbn isbn = 10015 [(google.api.field_behavior) = REQUIRED]; + Isbn isbn = 10015 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } // Request message for the Getisbn method message GetIsbnRequest { // The globally unique identifier for the resource string path = 10018 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "bookstore.example.com/isbn" } ]; } @@ -447,7 +447,7 @@ message GetIsbnRequest { message ListIsbnsRequest { // A field for the parent of isbn string parent = 10013 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { } ]; @@ -471,7 +471,7 @@ message ListIsbnsResponse { message CreatePublisherRequest { // A field for the parent of publisher string parent = 10013 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { } ]; @@ -479,14 +479,14 @@ message CreatePublisherRequest { string id = 10014; // The resource to perform the operation on. - Publisher publisher = 10015 [(google.api.field_behavior) = REQUIRED]; + Publisher publisher = 10015 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } // Request message for the Getpublisher method message GetPublisherRequest { // The globally unique identifier for the resource string path = 10018 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "bookstore.example.com/publisher" } ]; } @@ -495,12 +495,12 @@ message GetPublisherRequest { message UpdatePublisherRequest { // The globally unique identifier for the resource string path = 10018 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "bookstore.example.com/publisher" } ]; // The resource to perform the operation on. - Publisher publisher = 10015 [(google.api.field_behavior) = REQUIRED]; + Publisher publisher = 10015 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; // The update mask for the resource google.protobuf.FieldMask update_mask = 10012; @@ -510,19 +510,19 @@ message UpdatePublisherRequest { message DeletePublisherRequest { // The globally unique identifier for the resource string path = 10018 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "bookstore.example.com/publisher" } ]; // If true, the resource will be deleted, even if children still exist. - bool force = 10020 [(google.api.field_behavior) = OPTIONAL]; + bool force = 10020 [(aep.api.field_info).field_behavior = OPTIONAL]; } // Request message for the Listpublisher method message ListPublishersRequest { // A field for the parent of publisher string parent = 10013 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { } ]; @@ -546,10 +546,10 @@ message ListPublishersResponse { message ApplyPublisherRequest { // The globally unique identifier for the resource string path = 10018 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_behavior) = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "bookstore.example.com/publisher" } ]; // The resource to perform the operation on. - Publisher publisher = 10015 [(google.api.field_behavior) = REQUIRED]; + Publisher publisher = 10015 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; } diff --git a/rules/aep0121/no_mutable_cycles_test.go b/rules/aep0121/no_mutable_cycles_test.go index 72d57ac..a0fd92f 100644 --- a/rules/aep0121/no_mutable_cycles_test.go +++ b/rules/aep0121/no_mutable_cycles_test.go @@ -85,7 +85,7 @@ func TestNoMutableCycles(t *testing.T) { `[(google.api.resource_reference).type = "library.googleapis.com/Publisher"]`, `[ (google.api.resource_reference).type = "library.googleapis.com/Book", - (google.api.field_behavior) = OUTPUT_ONLY + (aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY ]`, "", "", @@ -97,7 +97,7 @@ func TestNoMutableCycles(t *testing.T) { `[(google.api.resource_reference).type = "library.googleapis.com/Library"]`, `[ (google.api.resource_reference).type = "library.googleapis.com/Book", - (google.api.field_behavior) = OUTPUT_ONLY + (aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY ]`, "", nil, @@ -106,7 +106,7 @@ func TestNoMutableCycles(t *testing.T) { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` import "google/api/resource.proto"; - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; message Book { option (google.api.resource) = { type: "library.googleapis.com/Book" diff --git a/rules/aep0122/resource_id_output_only_test.go b/rules/aep0122/resource_id_output_only_test.go index a03226f..af3c96e 100644 --- a/rules/aep0122/resource_id_output_only_test.go +++ b/rules/aep0122/resource_id_output_only_test.go @@ -27,15 +27,15 @@ func TestResourceIdOutputOnly(t *testing.T) { FieldBehavior string problems testutils.Problems }{ - {"ValidWithSuffix", "book_id", "[(google.api.field_behavior) = OUTPUT_ONLY]", testutils.Problems{}}, - {"ValidUID", "uid", "[(google.api.field_behavior) = OUTPUT_ONLY]", testutils.Problems{}}, + {"ValidWithSuffix", "book_id", "[(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]", testutils.Problems{}}, + {"ValidUID", "uid", "[(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]", testutils.Problems{}}, {"InvalidWithSuffix", "book_id", "", testutils.Problems{{Message: "OUTPUT_ONLY"}}}, {"InvalidUID", "uid", "", testutils.Problems{{Message: "OUTPUT_ONLY"}}}, {"SkipDifferentIdField", "foo_id", "", testutils.Problems{}}, } { f := testutils.ParseProto3Tmpl(t, ` import "google/api/resource.proto"; - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; message Book { option (google.api.resource) = { diff --git a/rules/aep0131/request_path_behavior_test.go b/rules/aep0131/request_path_behavior_test.go index 934aecb..05de8e8 100644 --- a/rules/aep0131/request_path_behavior_test.go +++ b/rules/aep0131/request_path_behavior_test.go @@ -27,13 +27,13 @@ func TestRequestNameBehavior(t *testing.T) { FieldBehavior string problems testutils.Problems }{ - {"Valid", "path", " [(google.api.field_behavior) = REQUIRED]", testutils.Problems{}}, - {"Missing", "path", "", testutils.Problems{{Message: "(google.api.field_behavior) = REQUIRED"}}}, + {"Valid", "path", " [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]", testutils.Problems{}}, + {"Missing", "path", "", testutils.Problems{{Message: "(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED"}}}, {"Irrelevant", "something_else", "", testutils.Problems{}}, } { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; message GetBookRequest { string {{.FieldName}} = 1{{.FieldBehavior}}; } diff --git a/rules/aep0131/request_required_fields_test.go b/rules/aep0131/request_required_fields_test.go index be47cc2..44950e7 100644 --- a/rules/aep0131/request_required_fields_test.go +++ b/rules/aep0131/request_required_fields_test.go @@ -36,13 +36,13 @@ func TestRequiredFieldTests(t *testing.T) { }, { "ValidOptionalReadMask", - "google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = OPTIONAL];", + "google.protobuf.FieldMask read_mask = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OPTIONAL];", "read_mask", nil, }, { "InvalidRequiredReadMask", - "google.protobuf.FieldMask read_mask = 2 [(google.api.field_behavior) = REQUIRED];", + "google.protobuf.FieldMask read_mask = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];", "read_mask", testutils.Problems{ {Message: `Get RPCs must only require fields explicitly described in AEPs, not "read_mask"`}, @@ -50,7 +50,7 @@ func TestRequiredFieldTests(t *testing.T) { }, { "InvalidRequiredUnknownField", - "bool create_iam = 3 [(google.api.field_behavior) = REQUIRED];", + "bool create_iam = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];", "create_iam", testutils.Problems{ {Message: `Get RPCs must only require fields explicitly described in AEPs, not "create_iam"`}, @@ -60,7 +60,7 @@ func TestRequiredFieldTests(t *testing.T) { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` import "google/api/annotations.proto"; - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; import "google/api/resource.proto"; import "google/protobuf/field_mask.proto"; @@ -76,7 +76,7 @@ func TestRequiredFieldTests(t *testing.T) { // The path of the book to retrieve. // Format: publishers/{publisher}/books/{book} string path = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { type: "library.googleapis.com/Book" } diff --git a/rules/aep0132/request_parent_behavior_test.go b/rules/aep0132/request_parent_behavior_test.go index f5a006b..422efc3 100644 --- a/rules/aep0132/request_parent_behavior_test.go +++ b/rules/aep0132/request_parent_behavior_test.go @@ -27,13 +27,13 @@ func TestRequestParentBehavior(t *testing.T) { FieldBehavior string problems testutils.Problems }{ - {"Valid", "parent", " [(google.api.field_behavior) = REQUIRED]", testutils.Problems{}}, - {"Missing", "parent", "", testutils.Problems{{Message: "(google.api.field_behavior) = REQUIRED"}}}, + {"Valid", "parent", " [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]", testutils.Problems{}}, + {"Missing", "parent", "", testutils.Problems{{Message: "(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED"}}}, {"Irrelevant", "something_else", "", testutils.Problems{}}, } { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; message ListBooksRequest { string {{.FieldName}} = 1{{.FieldBehavior}}; } diff --git a/rules/aep0132/request_required_fields_test.go b/rules/aep0132/request_required_fields_test.go index cf5b845..cab1f13 100644 --- a/rules/aep0132/request_required_fields_test.go +++ b/rules/aep0132/request_required_fields_test.go @@ -36,13 +36,13 @@ func TestRequiredFieldTests(t *testing.T) { }, { "ValidOptionalPageSize", - "int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];", + "int32 page_size = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OPTIONAL];", "page_size", nil, }, { "InvalidRequiredPageSize", - "int32 page_size = 2 [(google.api.field_behavior) = REQUIRED];", + "int32 page_size = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];", "page_size", testutils.Problems{ {Message: `List RPCs must only require fields explicitly described in AEPs, not "page_size"`}, @@ -50,7 +50,7 @@ func TestRequiredFieldTests(t *testing.T) { }, { "InvalidRequiredUnknownField", - "bool create_iam = 3 [(google.api.field_behavior) = REQUIRED];", + "bool create_iam = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];", "create_iam", testutils.Problems{ {Message: `List RPCs must only require fields explicitly described in AEPs, not "create_iam"`}, @@ -60,7 +60,7 @@ func TestRequiredFieldTests(t *testing.T) { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` import "google/api/annotations.proto"; - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; import "google/api/resource.proto"; service Library { @@ -75,7 +75,7 @@ func TestRequiredFieldTests(t *testing.T) { // The parent, which owns this collection of books. // Format: publishers/{publisher} string parent = 1 [ - (google.api.field_behavior) = REQUIRED, + (aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED, (google.api.resource_reference) = { child_type: "library.googleapis.com/Book" }]; diff --git a/rules/aep0133/request_parent_behavior_test.go b/rules/aep0133/request_parent_behavior_test.go index cd73e28..f2aea09 100644 --- a/rules/aep0133/request_parent_behavior_test.go +++ b/rules/aep0133/request_parent_behavior_test.go @@ -27,13 +27,13 @@ func TestRequestParentBehavior(t *testing.T) { FieldBehavior string problems testutils.Problems }{ - {"Valid", "parent", " [(google.api.field_behavior) = REQUIRED]", testutils.Problems{}}, - {"Missing", "parent", "", testutils.Problems{{Message: "(google.api.field_behavior) = REQUIRED"}}}, + {"Valid", "parent", " [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]", testutils.Problems{}}, + {"Missing", "parent", "", testutils.Problems{{Message: "(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED"}}}, {"Irrelevant", "something_else", "", testutils.Problems{}}, } { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; message CreateBookRequest { string {{.FieldName}} = 1{{.FieldBehavior}}; } diff --git a/rules/aep0133/request_required_fields_test.go b/rules/aep0133/request_required_fields_test.go index a35d56a..adcdb2e 100644 --- a/rules/aep0133/request_required_fields_test.go +++ b/rules/aep0133/request_required_fields_test.go @@ -45,21 +45,21 @@ func TestRequiredFieldTests(t *testing.T) { }, { "ValidWithSingularAndIdField", - "string id = 3 [(google.api.field_behavior) = OPTIONAL];", + "string id = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OPTIONAL];", "", "bookShelf", nil, }, { "ValidOptionalValidateOnly", - "string validate_only = 3 [(google.api.field_behavior) = OPTIONAL];", + "string validate_only = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OPTIONAL];", "validate_only", "", nil, }, { "InvalidRequiredValidateOnly", - "bool validate_only = 3 [(google.api.field_behavior) = REQUIRED];", + "bool validate_only = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];", "validate_only", "", testutils.Problems{ @@ -68,7 +68,7 @@ func TestRequiredFieldTests(t *testing.T) { }, { "InvalidRequiredUnknownField", - "bool create_iam = 3 [(google.api.field_behavior) = REQUIRED];", + "bool create_iam = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];", "create_iam", "", testutils.Problems{ @@ -77,7 +77,7 @@ func TestRequiredFieldTests(t *testing.T) { }, { "InvalidRequiredUnknownMessageField", - "Foo foo = 3 [(google.api.field_behavior) = REQUIRED];", + "Foo foo = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];", "foo", "", testutils.Problems{ @@ -88,7 +88,7 @@ func TestRequiredFieldTests(t *testing.T) { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` import "google/api/annotations.proto"; - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; import "google/api/resource.proto"; service Library { @@ -112,10 +112,10 @@ func TestRequiredFieldTests(t *testing.T) { message CreateBookShelfRequest { string parent = 1 [ - (google.api.field_behavior) = REQUIRED + (aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED ]; BookShelf book_shelf = 2 [ - (google.api.field_behavior) = REQUIRED + (aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED ]; {{.Fields}} } diff --git a/rules/aep0133/request_resource_behavior_test.go b/rules/aep0133/request_resource_behavior_test.go index 3378ae5..c2c9330 100644 --- a/rules/aep0133/request_resource_behavior_test.go +++ b/rules/aep0133/request_resource_behavior_test.go @@ -28,14 +28,14 @@ func TestRequestResourceBehavior(t *testing.T) { FieldBehavior string problems testutils.Problems }{ - {"Valid", "CreateBookRequest", "Book", " [(google.api.field_behavior) = REQUIRED]", testutils.Problems{}}, - {"Missing", "CreateBookRequest", "Book", "", testutils.Problems{{Message: "(google.api.field_behavior) = REQUIRED"}}}, + {"Valid", "CreateBookRequest", "Book", " [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]", testutils.Problems{}}, + {"Missing", "CreateBookRequest", "Book", "", testutils.Problems{{Message: "(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED"}}}, {"IrrelevantOtherField", "CreateBookRequest", "Parchment", "", testutils.Problems{}}, {"IrrelevantNotCreateRequest", "FrobBookRequest", "Book", "", testutils.Problems{}}, } { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; message {{.MessageName}} { {{.FieldType}} book = 1{{.FieldBehavior}}; } diff --git a/rules/aep0134/request_required_fields_test.go b/rules/aep0134/request_required_fields_test.go index 48a950a..badcdb8 100644 --- a/rules/aep0134/request_required_fields_test.go +++ b/rules/aep0134/request_required_fields_test.go @@ -36,25 +36,25 @@ func TestRequiredFieldTests(t *testing.T) { }, { "ValidOptionalUpdateMask", - "google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];", + "google.protobuf.FieldMask update_mask = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OPTIONAL];", "update_mask", nil, }, { "ValidRequiredUpdateMask", - "google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];", + "google.protobuf.FieldMask update_mask = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];", "update_mask", nil, }, { "ValidOptionalValidateOnly", - "bool validate_only = 3 [(google.api.field_behavior) = OPTIONAL];", + "bool validate_only = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OPTIONAL];", "validate_only", nil, }, { "InvalidRequiredValidateOnly", - "bool validate_only = 3 [(google.api.field_behavior) = REQUIRED];", + "bool validate_only = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];", "validate_only", testutils.Problems{ {Message: `Update RPCs must only require fields explicitly described in AEPs, not "validate_only"`}, @@ -62,7 +62,7 @@ func TestRequiredFieldTests(t *testing.T) { }, { "InvalidRequiredUnknownField", - "bool create_iam = 3 [(google.api.field_behavior) = REQUIRED];", + "bool create_iam = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];", "create_iam", testutils.Problems{ {Message: `Update RPCs must only require fields explicitly described in AEPs, not "create_iam"`}, @@ -70,7 +70,7 @@ func TestRequiredFieldTests(t *testing.T) { }, { "InvalidRequiredUnknownMessageField", - "Foo foo = 3 [(google.api.field_behavior) = REQUIRED];", + "Foo foo = 3 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];", "foo", testutils.Problems{ {Message: `Update RPCs must only require fields explicitly described in AEPs, not "foo"`}, @@ -80,7 +80,7 @@ func TestRequiredFieldTests(t *testing.T) { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` import "google/api/annotations.proto"; - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; import "google/api/resource.proto"; import "google/protobuf/field_mask.proto"; @@ -103,7 +103,7 @@ func TestRequiredFieldTests(t *testing.T) { message UpdateBookShelfRequest { BookShelf book_shelf = 1 [ - (google.api.field_behavior) = REQUIRED + (aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED ]; {{.Fields}} } diff --git a/rules/aep0135/request_path_behavior_test.go b/rules/aep0135/request_path_behavior_test.go index f015e28..93f0976 100644 --- a/rules/aep0135/request_path_behavior_test.go +++ b/rules/aep0135/request_path_behavior_test.go @@ -27,13 +27,13 @@ func TestRequestNameBehavior(t *testing.T) { FieldBehavior string problems testutils.Problems }{ - {"Valid", "path", " [(google.api.field_behavior) = REQUIRED]", testutils.Problems{}}, - {"Missing", "path", "", testutils.Problems{{Message: "(google.api.field_behavior) = REQUIRED"}}}, + {"Valid", "path", " [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]", testutils.Problems{}}, + {"Missing", "path", "", testutils.Problems{{Message: "(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED"}}}, {"Irrelevant", "something_else", "", testutils.Problems{}}, } { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; message DeleteBookRequest { string {{.FieldName}} = 1{{.FieldBehavior}}; } diff --git a/rules/aep0135/request_required_fields_test.go b/rules/aep0135/request_required_fields_test.go index 104c350..1cfa741 100644 --- a/rules/aep0135/request_required_fields_test.go +++ b/rules/aep0135/request_required_fields_test.go @@ -36,13 +36,13 @@ func TestRequiredFieldTests(t *testing.T) { }, { "ValidOptionalAllowMissing", - "bool allow_missing = 2 [(google.api.field_behavior) = OPTIONAL];", + "bool allow_missing = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OPTIONAL];", "allow_missing", nil, }, { "InvalidRequiredAllowMissing", - "bool allow_missing = 2 [(google.api.field_behavior) = REQUIRED];", + "bool allow_missing = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];", "allow_missing", testutils.Problems{ {Message: `Delete RPCs must only require fields explicitly described in AEPs, not "allow_missing"`}, @@ -50,7 +50,7 @@ func TestRequiredFieldTests(t *testing.T) { }, { "InvalidRequiredUnknownField", - "bool create_iam = 2 [(google.api.field_behavior) = REQUIRED];", + "bool create_iam = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED];", "create_iam", testutils.Problems{ {Message: `Delete RPCs must only require fields explicitly described in AEPs, not "create_iam"`}, @@ -60,7 +60,7 @@ func TestRequiredFieldTests(t *testing.T) { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` import "google/api/annotations.proto"; - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; import "google/api/resource.proto"; import "google/longrunning/operations.proto"; @@ -78,7 +78,7 @@ func TestRequiredFieldTests(t *testing.T) { message DeleteBookRequest { string path = 1 [ - (google.api.field_behavior) = REQUIRED + (aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED ]; {{.Fields}} } diff --git a/rules/aep0148/field_behavior_test.go b/rules/aep0148/field_behavior_test.go index b8220a2..8316c74 100644 --- a/rules/aep0148/field_behavior_test.go +++ b/rules/aep0148/field_behavior_test.go @@ -22,7 +22,7 @@ import ( func TestFieldBehavior(t *testing.T) { const messageOptsResource = `option (google.api.resource).type = "library.googleapis.com/Book";` - const fieldOptsOutputOnly = `[(google.api.field_behavior) = OUTPUT_ONLY]` + const fieldOptsOutputOnly = `[(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]` missingOutputOnly := testutils.Problems{{Message: "OUTPUT_ONLY"}} for _, test := range []struct { @@ -45,7 +45,7 @@ func TestFieldBehavior(t *testing.T) { } { t.Run(test.name, func(t *testing.T) { file := testutils.ParseProto3Tmpl(t, ` - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; import "google/api/resource.proto"; import "google/protobuf/timestamp.proto"; message Book { diff --git a/rules/aep0164/request_name_behavior_test.go b/rules/aep0164/request_name_behavior_test.go index 34e4229..fcf55a1 100644 --- a/rules/aep0164/request_name_behavior_test.go +++ b/rules/aep0164/request_name_behavior_test.go @@ -28,14 +28,14 @@ func TestRequestNameBehavior(t *testing.T) { FieldBehavior string problems testutils.Problems }{ - {"Valid", "UndeleteBookRequest", "name", " [(google.api.field_behavior) = REQUIRED]", testutils.Problems{}}, - {"Missing", "UndeleteBookRequest", "name", "", testutils.Problems{{Message: "(google.api.field_behavior) = REQUIRED"}}}, + {"Valid", "UndeleteBookRequest", "name", " [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]", testutils.Problems{}}, + {"Missing", "UndeleteBookRequest", "name", "", testutils.Problems{{Message: "(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED"}}}, {"IrrelevantMessage", "AcquireBookRequest", "name", "", testutils.Problems{}}, {"IrrelevantField", "UndeleteBookRequest", "something_else", "", testutils.Problems{}}, } { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; message {{.MessageName}} { string {{.FieldName}} = 1{{.FieldBehavior}}; } diff --git a/rules/aep0216/state_field_output_only_test.go b/rules/aep0216/state_field_output_only_test.go index 53ef90f..d8dc7c7 100644 --- a/rules/aep0216/state_field_output_only_test.go +++ b/rules/aep0216/state_field_output_only_test.go @@ -29,9 +29,9 @@ func TestStateFieldOutputOnly(t *testing.T) { problems testutils.Problems }{ // Accepted - {"ValidState", "state", "State", "[(google.api.field_behavior) = OUTPUT_ONLY]", testutils.Problems{}}, - {"ValidOtherFieldName", "country", "State", "[(google.api.field_behavior) = OUTPUT_ONLY]", testutils.Problems{}}, - {"ValidStateSuffix", "state", "WritersBlockState", "[(google.api.field_behavior) = OUTPUT_ONLY]", testutils.Problems{}}, + {"ValidState", "state", "State", "[(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]", testutils.Problems{}}, + {"ValidOtherFieldName", "country", "State", "[(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]", testutils.Problems{}}, + {"ValidStateSuffix", "state", "WritersBlockState", "[(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]", testutils.Problems{}}, // No Annotation {"InvalidState", "state", "State", "", testutils.Problems{{Message: "OUTPUT_ONLY"}}}, @@ -45,7 +45,7 @@ func TestStateFieldOutputOnly(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; message Book { enum State { diff --git a/rules/internal/utils/common_lints.go b/rules/internal/utils/common_lints.go index 979081e..c28b4b5 100644 --- a/rules/internal/utils/common_lints.go +++ b/rules/internal/utils/common_lints.go @@ -94,10 +94,10 @@ func LintFieldPresentAndSingularString(field string) func(*desc.MessageDescripto } } -func lintFieldBehavior(f *desc.FieldDescriptor, want string) []lint.Problem { +func lintFieldBehavior(f *desc.FieldDescriptor, want string, wantMessage string) []lint.Problem { if !GetFieldBehavior(f).Contains(want) { return []lint.Problem{{ - Message: fmt.Sprintf("The `%s` field should include `(google.api.field_behavior) = %s`.", f.GetName(), want), + Message: fmt.Sprintf("The `%s` field should include `(aep.api.field_info).field_behavior = %s`.", f.GetName(), wantMessage), Descriptor: f, }} } @@ -106,12 +106,12 @@ func lintFieldBehavior(f *desc.FieldDescriptor, want string) []lint.Problem { // LintRequiredField returns a problem if the field's behavior is not REQUIRED. func LintRequiredField(f *desc.FieldDescriptor) []lint.Problem { - return lintFieldBehavior(f, "REQUIRED") + return lintFieldBehavior(f, "REQUIRED", "FIELD_BEHAVIOR_REQUIRED") } // LintOutputOnlyField returns a problem if the field's behavior is not OUTPUT_ONLY. func LintOutputOnlyField(f *desc.FieldDescriptor) []lint.Problem { - return lintFieldBehavior(f, "OUTPUT_ONLY") + return lintFieldBehavior(f, "OUTPUT_ONLY", "FIELD_BEHAVIOR_OUTPUT_ONLY") } // LintFieldResourceReference returns a problem if the field does not have a resource reference annotation. diff --git a/rules/internal/utils/common_lints_test.go b/rules/internal/utils/common_lints_test.go index 6f50b17..6204375 100644 --- a/rules/internal/utils/common_lints_test.go +++ b/rules/internal/utils/common_lints_test.go @@ -38,12 +38,12 @@ func TestLintRequiredField(t *testing.T) { Annotation string problems testutils.Problems }{ - {"Valid", `[(google.api.field_behavior) = REQUIRED]`, nil}, + {"Valid", `[(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]`, nil}, {"Invalid", ``, testutils.Problems{{Message: "REQUIRED"}}}, } { t.Run(test.testName, func(t *testing.T) { f := testutils.ParseProto3Tmpl(t, ` - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; message Message { string foo = 1 {{.Annotation}}; } diff --git a/rules/internal/utils/extension.go b/rules/internal/utils/extension.go index ceb6efa..6a0b5b9 100644 --- a/rules/internal/utils/extension.go +++ b/rules/internal/utils/extension.go @@ -26,12 +26,12 @@ import ( ) // GetFieldBehavior returns a stringset.Set of FieldBehavior annotations for -// the given field. It checks both google.api.field_behavior and aep.api.field_info.field_behavior. +// the given field. It checks both aep.api.field_behavior and aep.api.field_info.field_behavior. func GetFieldBehavior(f *desc.FieldDescriptor) stringset.Set { opts := f.GetFieldOptions() answer := stringset.New() - // Check google.api.field_behavior extension + // Check aep.api.field_behavior extension if x := proto.GetExtension(opts, apb.E_FieldBehavior); x != nil { for _, fb := range x.([]apb.FieldBehavior) { answer.Add(fb.String()) @@ -52,7 +52,7 @@ func GetFieldBehavior(f *desc.FieldDescriptor) stringset.Set { } // convertAEPFieldBehaviorToString converts aep.api.FieldBehavior to a string format -// compatible with google.api.FieldBehavior strings. +// compatible with aep.api.FieldBehavior strings. func convertAEPFieldBehaviorToString(fb aepapi.FieldBehavior) string { switch fb { case aepapi.FieldBehavior_FIELD_BEHAVIOR_OPTIONAL: diff --git a/rules/internal/utils/extension_test.go b/rules/internal/utils/extension_test.go index 1451d30..3ed901e 100644 --- a/rules/internal/utils/extension_test.go +++ b/rules/internal/utils/extension_test.go @@ -26,14 +26,14 @@ import ( func TestGetFieldBehavior(t *testing.T) { fd := testutils.ParseProto3String(t, ` - import "google/api/field_behavior.proto"; + import "aep/api/field_info.proto"; message Book { string name = 1 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = OUTPUT_ONLY]; + (aep.api.field_info).field_behavior = FIELD_BEHAVIOR_IMMUTABLE, + (aep.api.field_info).field_behavior = FIELD_BEHAVIOR_OUTPUT_ONLY]; - string title = 2 [(google.api.field_behavior) = REQUIRED]; + string title = 2 [(aep.api.field_info).field_behavior = FIELD_BEHAVIOR_REQUIRED]; string summary = 3; } From 5c9706a2dcbb30de654c96489d8ac4dccd134b6b Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Tue, 14 Oct 2025 11:14:40 -0700 Subject: [PATCH 3/6] Change docs reference --- docs/rules/0131/request-path-behavior.md | 4 ++-- docs/rules/0132/request-parent-behavior.md | 4 ++-- docs/rules/0133/request-parent-behavior.md | 4 ++-- docs/rules/0133/request-resource-behavior.md | 4 ++-- docs/rules/0135/request-path-behavior.md | 4 ++-- docs/rules/0162/commit-request-name-behavior.md | 4 ++-- docs/rules/0162/delete-revision-request-name-behavior.md | 4 ++-- docs/rules/0162/rollback-request-name-behavior.md | 4 ++-- docs/rules/0162/rollback-request-revision-id-behavior.md | 4 ++-- docs/rules/0162/tag-revision-request-name-behavior.md | 4 ++-- docs/rules/0162/tag-revision-request-tag-behavior.md | 4 ++-- docs/rules/0164/request-name-behavior.md | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/rules/0131/request-path-behavior.md b/docs/rules/0131/request-path-behavior.md index 5341c30..0e9ec94 100644 --- a/docs/rules/0131/request-path-behavior.md +++ b/docs/rules/0131/request-path-behavior.md @@ -12,14 +12,14 @@ redirect_from: # Get methods: Field behavior This rule enforces that all `Get` standard methods have -`aep.api.field_behavior` set to `REQUIRED` on their `string path` field, as +`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on their `string path` field, as mandated in [AEP-131][]. ## Details This rule looks at any message matching `Get*Request` and complains if the `path` field does not have a `aep.api.field_behavior` annotation with a -value of `REQUIRED`. +value of `FIELD_BEHAVIOR_REQUIRED`. ## Examples diff --git a/docs/rules/0132/request-parent-behavior.md b/docs/rules/0132/request-parent-behavior.md index b490f1c..4b81ab3 100644 --- a/docs/rules/0132/request-parent-behavior.md +++ b/docs/rules/0132/request-parent-behavior.md @@ -12,14 +12,14 @@ redirect_from: # List methods: Field behavior This rule enforces that all `List` standard methods have -`aep.api.field_behavior` set to `REQUIRED` on their `string parent` field, +`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on their `string parent` field, as mandated in [AEP-132][]. ## Details This rule looks at any message matching `List*Request` and complains if the `parent` field does not have a `aep.api.field_behavior` annotation with a -value of `REQUIRED`. +value of `FIELD_BEHAVIOR_REQUIRED`. ## Examples diff --git a/docs/rules/0133/request-parent-behavior.md b/docs/rules/0133/request-parent-behavior.md index db7bd1f..29a5c0b 100644 --- a/docs/rules/0133/request-parent-behavior.md +++ b/docs/rules/0133/request-parent-behavior.md @@ -12,14 +12,14 @@ redirect_from: # Create methods: Field behavior This rule enforces that all `Create` standard methods have -`aep.api.field_behavior` set to `REQUIRED` on their `string parent` field, +`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on their `string parent` field, as mandated in [AEP-133][]. ## Details This rule looks at any message matching `Create*Request` and complains if the `parent` field does not have a `aep.api.field_behavior` annotation with a -value of `REQUIRED`. +value of `FIELD_BEHAVIOR_REQUIRED`. ## Examples diff --git a/docs/rules/0133/request-resource-behavior.md b/docs/rules/0133/request-resource-behavior.md index a43e5ad..6eb2481 100644 --- a/docs/rules/0133/request-resource-behavior.md +++ b/docs/rules/0133/request-resource-behavior.md @@ -12,14 +12,14 @@ redirect_from: # Create methods: Field behavior This rule enforces that all `Create` standard methods have -`aep.api.field_behavior` set to `REQUIRED` on the field representing the +`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on the field representing the resource, as mandated in [AEP-133][]. ## Details This rule looks at any message matching `Create*Request` and complains if the resource field does not have a `aep.api.field_behavior` annotation with a -value of `REQUIRED`. +value of `FIELD_BEHAVIOR_REQUIRED`. ## Examples diff --git a/docs/rules/0135/request-path-behavior.md b/docs/rules/0135/request-path-behavior.md index 9b51595..00f6ca8 100644 --- a/docs/rules/0135/request-path-behavior.md +++ b/docs/rules/0135/request-path-behavior.md @@ -12,14 +12,14 @@ redirect_from: # Delete methods: Field behavior This rule enforces that all `Delete` standard methods have -`aep.api.field_behavior` set to `REQUIRED` on their `string path` field, as +`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on their `string path` field, as mandated in [AEP-135][]. ## Details This rule looks at any message matching `Delete*Request` and complains if the `path` field does not have a `aep.api.field_behavior` annotation with a -value of `REQUIRED`. +value of `FIELD_BEHAVIOR_REQUIRED`. ## Examples diff --git a/docs/rules/0162/commit-request-name-behavior.md b/docs/rules/0162/commit-request-name-behavior.md index 3153f7e..3d39831 100644 --- a/docs/rules/0162/commit-request-name-behavior.md +++ b/docs/rules/0162/commit-request-name-behavior.md @@ -12,14 +12,14 @@ redirect_from: # Commit requests: Name field behavior This rule enforces that all `Commit` requests have -`aep.api.field_behavior` set to `REQUIRED` on their `string name` field, as +`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on their `string name` field, as mandated in [AEP-162][]. ## Details This rule looks at any message matching `Commit*Request` and complains if the `name` field does not have a `aep.api.field_behavior` annotation with a -value of `REQUIRED`. +value of `FIELD_BEHAVIOR_REQUIRED`. ## Examples diff --git a/docs/rules/0162/delete-revision-request-name-behavior.md b/docs/rules/0162/delete-revision-request-name-behavior.md index c098170..9f52e12 100644 --- a/docs/rules/0162/delete-revision-request-name-behavior.md +++ b/docs/rules/0162/delete-revision-request-name-behavior.md @@ -12,14 +12,14 @@ redirect_from: # Delete Revision requests: Name field behavior This rule enforces that all Delete Revision requests have -`aep.api.field_behavior` set to `REQUIRED` on their `string name` field, as +`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on their `string name` field, as mandated in [AEP-162][]. ## Details This rule looks at any message matching `Delete*RevisionRequest` and complains if the `name` field does not have a `aep.api.field_behavior` annotation with a -value of `REQUIRED`. +value of `FIELD_BEHAVIOR_REQUIRED`. ## Examples diff --git a/docs/rules/0162/rollback-request-name-behavior.md b/docs/rules/0162/rollback-request-name-behavior.md index ef47223..fb8d96e 100644 --- a/docs/rules/0162/rollback-request-name-behavior.md +++ b/docs/rules/0162/rollback-request-name-behavior.md @@ -12,14 +12,14 @@ redirect_from: # Rollback requests: Name field behavior This rule enforces that all `Rollback` requests have -`aep.api.field_behavior` set to `REQUIRED` on their `string name` field, as +`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on their `string name` field, as mandated in [AEP-162][]. ## Details This rule looks at any message matching `Rollback*Request` and complains if the `name` field does not have a `aep.api.field_behavior` annotation with a -value of `REQUIRED`. +value of `FIELD_BEHAVIOR_REQUIRED`. ## Examples diff --git a/docs/rules/0162/rollback-request-revision-id-behavior.md b/docs/rules/0162/rollback-request-revision-id-behavior.md index 18057f2..b1810e8 100644 --- a/docs/rules/0162/rollback-request-revision-id-behavior.md +++ b/docs/rules/0162/rollback-request-revision-id-behavior.md @@ -12,14 +12,14 @@ redirect_from: # Rollback requests: Revision ID field behavior This rule enforces that all `Rollback` requests have -`aep.api.field_behavior` set to `REQUIRED` on their `string revision_id` field, as +`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on their `string revision_id` field, as mandated in [AEP-162][]. ## Details This rule looks at any message matching `Rollback*Request` and complains if the `revision_id` field does not have a `aep.api.field_behavior` annotation with a -value of `REQUIRED`. +value of `FIELD_BEHAVIOR_REQUIRED`. ## Examples diff --git a/docs/rules/0162/tag-revision-request-name-behavior.md b/docs/rules/0162/tag-revision-request-name-behavior.md index c2787a2..57a8ee7 100644 --- a/docs/rules/0162/tag-revision-request-name-behavior.md +++ b/docs/rules/0162/tag-revision-request-name-behavior.md @@ -12,14 +12,14 @@ redirect_from: # Tag Revision requests: Name field behavior This rule enforces that all Tag Revision requests have -`aep.api.field_behavior` set to `REQUIRED` on their `string name` field, as +`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on their `string name` field, as mandated in [AEP-162][]. ## Details This rule looks at any message matching `Tag*RevisionRequest` and complains if the `name` field does not have a `aep.api.field_behavior` annotation with a -value of `REQUIRED`. +value of `FIELD_BEHAVIOR_REQUIRED`. ## Examples diff --git a/docs/rules/0162/tag-revision-request-tag-behavior.md b/docs/rules/0162/tag-revision-request-tag-behavior.md index eecfe33..b1b7ab1 100644 --- a/docs/rules/0162/tag-revision-request-tag-behavior.md +++ b/docs/rules/0162/tag-revision-request-tag-behavior.md @@ -12,14 +12,14 @@ redirect_from: # Tag Revision requests: Tag field behavior This rule enforces that all Tag Revision requests have -`aep.api.field_behavior` set to `REQUIRED` on their `string tag` field, as +`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on their `string tag` field, as mandated in [AEP-162][]. ## Details This rule looks at any message matching `Tag*RevisionRequest` and complains if the `tag` field does not have a `aep.api.field_behavior` annotation with a -value of `REQUIRED`. +value of `FIELD_BEHAVIOR_REQUIRED`. ## Examples diff --git a/docs/rules/0164/request-name-behavior.md b/docs/rules/0164/request-name-behavior.md index 3fd915d..511148b 100644 --- a/docs/rules/0164/request-name-behavior.md +++ b/docs/rules/0164/request-name-behavior.md @@ -12,14 +12,14 @@ redirect_from: # Undelete methods: Field behavior This rule enforces that all `Undelete` methods have -`aep.api.field_behavior` set to `REQUIRED` on their `string name` field, as +`aep.api.field_behavior` set to `FIELD_BEHAVIOR_REQUIRED` on their `string name` field, as mandated in [AEP-164][]. ## Details This rule looks at any message matching `Undelete*Request` and complains if the `name` field does not have a `aep.api.field_behavior` annotation with a -value of `REQUIRED`. +value of `FIELD_BEHAVIOR_REQUIRED`. ## Examples From 13a012ff55cca20aef5f1df01eedc3659ce3a76c Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Fri, 17 Oct 2025 12:26:08 -0700 Subject: [PATCH 4/6] Get dependencies in order --- go.mod | 49 ++++++++++++------------ go.sum | 117 +++++++++++++++++++++++++++++++++------------------------ 2 files changed, 92 insertions(+), 74 deletions(-) diff --git a/go.mod b/go.mod index bce45b0..a406b1f 100644 --- a/go.mod +++ b/go.mod @@ -1,47 +1,46 @@ module github.com/aep-dev/api-linter -go 1.23 - -toolchain go1.23.2 +go 1.24.0 require ( bitbucket.org/creachadair/stringset v0.0.14 - buf.build/gen/go/aep/api/protocolbuffers/go v1.36.10-20251011185002-1454930c8f99.1 - buf.build/go/bufplugin v0.5.0 - cloud.google.com/go/longrunning v0.6.1 - github.com/bmatcuk/doublestar/v4 v4.6.1 + buf.build/gen/go/aep/api/protocolbuffers/go v1.36.10-20251016045117-f9844266f27f.1 + buf.build/go/bufplugin v0.9.0 + cloud.google.com/go/longrunning v0.7.0 + github.com/bmatcuk/doublestar/v4 v4.9.1 github.com/gertd/go-pluralize v0.2.1 github.com/google/go-cmp v0.7.0 github.com/jhump/protoreflect v1.17.0 github.com/lithammer/dedent v1.1.0 github.com/olekukonko/tablewriter v0.0.5 - github.com/spf13/pflag v1.0.5 - github.com/stoewer/go-strcase v1.3.0 - google.golang.org/genproto v0.0.0-20241007155032-5fefd90f89a9 - google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 + github.com/spf13/pflag v1.0.10 + github.com/stoewer/go-strcase v1.3.1 + google.golang.org/genproto v0.0.0-20251014184007-4626949a642f + google.golang.org/genproto/googleapis/api v0.0.0-20251014184007-4626949a642f google.golang.org/protobuf v1.36.10 gopkg.in/yaml.v2 v2.4.0 ) require ( - buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.35.1-20240928190436-5e8abcfd7a7e.1 // indirect - buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20240221180331-f05a6f4403ce.1 // indirect - buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.35.1-20241007202033-cf42259fcbfc.1 // indirect + buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.36.10-20250718181942-e35f9b667443.1 // indirect + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20250912141014-52f32327d4b0.1 // indirect + buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.10-20241007202033-cf42259fcbfc.1 // indirect + buf.build/go/protovalidate v1.0.0 // indirect buf.build/go/spdx v0.2.0 // indirect + cel.dev/expr v0.24.0 // indirect github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/bufbuild/protocompile v0.14.1 // indirect - github.com/bufbuild/protovalidate-go v0.7.2 // indirect + github.com/clipperhouse/uax29/v2 v2.2.0 // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/cel-go v0.21.0 // indirect + github.com/google/cel-go v0.26.1 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.16 // indirect - github.com/rivo/uniseg v0.4.7 // indirect - golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect - golang.org/x/net v0.30.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/text v0.19.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect - google.golang.org/grpc v1.67.1 // indirect + github.com/mattn/go-runewidth v0.0.19 // indirect + golang.org/x/exp v0.0.0-20251009144603-d2f985daa21b // indirect + golang.org/x/net v0.46.0 // indirect + golang.org/x/sync v0.17.0 // indirect + golang.org/x/sys v0.37.0 // indirect + golang.org/x/text v0.30.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251014184007-4626949a642f // indirect + google.golang.org/grpc v1.76.0 // indirect pluginrpc.com/pluginrpc v0.5.0 // indirect ) diff --git a/go.sum b/go.sum index 6cd7b14..59735d8 100644 --- a/go.sum +++ b/go.sum @@ -1,40 +1,48 @@ bitbucket.org/creachadair/stringset v0.0.14 h1:t1ejQyf8utS4GZV/4fM+1gvYucggZkfhb+tMobDxYOE= bitbucket.org/creachadair/stringset v0.0.14/go.mod h1:Ej8fsr6rQvmeMDf6CCWMWGb14H9mz8kmDgPPTdiVT0w= -buf.build/gen/go/aep/api/protocolbuffers/go v1.36.10-20251011185002-1454930c8f99.1 h1:oLb4mOvnV3wNCVcbHsw4KCtQWtMbf8VURShtwM0N2A0= -buf.build/gen/go/aep/api/protocolbuffers/go v1.36.10-20251011185002-1454930c8f99.1/go.mod h1:6eR/uxhdJhB/Gk0vgKgcar7k/qKXZEArkfpF87AjF/A= -buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.35.1-20240928190436-5e8abcfd7a7e.1 h1:SW2yM+ioegkQY/LIKDatCalB0Zi/9VqefPGd5VPD62o= -buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.35.1-20240928190436-5e8abcfd7a7e.1/go.mod h1:rYPnjsUZ2lGpoQ/T322HWZQil9/MIZF2njP+/u/0GKg= -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20240221180331-f05a6f4403ce.1 h1:19otp5rJIcsvEF2aZtpXLSunZFD6kaHnP/u107WpLQI= -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20240221180331-f05a6f4403ce.1/go.mod h1:fUl8CEN/6ZAMk6bP8ahBJPUJw7rbp+j4x+wCcYi2IG4= -buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.35.1-20241007202033-cf42259fcbfc.1 h1:rPi3qs3qpDIXIl5QW2IPOaYZhppRkvuVKwEZrfhpy78= -buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.35.1-20241007202033-cf42259fcbfc.1/go.mod h1:4IVMTaeh4JIjBYcGFLlTorfWpKVEXDjDfHAgKTeR0Ds= -buf.build/go/bufplugin v0.5.0 h1:pmK1AloAMp+4woH5hEisK9qVmDdLySzIKexUUVZLJ2Q= -buf.build/go/bufplugin v0.5.0/go.mod h1:r7Y8tpqpErLtUXUecEgwAHnjihY03YbN0IaBFNJF/x0= +buf.build/gen/go/aep/api/protocolbuffers/go v1.36.10-20251016045117-f9844266f27f.1 h1:jK64CGldQTGX2ESi+v41uERp+z28OFqGyAn/T/Qs8Q0= +buf.build/gen/go/aep/api/protocolbuffers/go v1.36.10-20251016045117-f9844266f27f.1/go.mod h1:JOZpZ+zS3G2OKO02hKlEazAGR5X9uVpFyeCamXBXg5c= +buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.36.10-20250718181942-e35f9b667443.1 h1:FzJGrb8r7vir+P3zJ5Ebey8p54LYTYtQsrM/U35YO9Q= +buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go v1.36.10-20250718181942-e35f9b667443.1/go.mod h1:E6HwqUm4Ag7bXtg/tX7jHWO7CgpknbmeACgDax0icV0= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20250912141014-52f32327d4b0.1 h1:31on4W/yPcV4nZHL4+UCiCvLPsMqe/vJcNg8Rci0scc= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.10-20250912141014-52f32327d4b0.1/go.mod h1:fUl8CEN/6ZAMk6bP8ahBJPUJw7rbp+j4x+wCcYi2IG4= +buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.10-20241007202033-cf42259fcbfc.1 h1:CzM0kZcoaIr8+R4i8QVorUNRM/CqMr87i3j+w2pdpCc= +buf.build/gen/go/pluginrpc/pluginrpc/protocolbuffers/go v1.36.10-20241007202033-cf42259fcbfc.1/go.mod h1:bG+Fa7tcA+4pW0JdOh4h7iKjleyZIKhfVzVS10qfrnk= +buf.build/go/bufplugin v0.9.0 h1:ktZJNP3If7ldcWVqh46XKeiYJVPxHQxCfjzVQDzZ/lo= +buf.build/go/bufplugin v0.9.0/go.mod h1:Z0CxA3sKQ6EPz/Os4kJJneeRO6CjPeidtP1ABh5jPPY= +buf.build/go/protovalidate v1.0.0 h1:IAG1etULddAy93fiBsFVhpj7es5zL53AfB/79CVGtyY= +buf.build/go/protovalidate v1.0.0/go.mod h1:KQmEUrcQuC99hAw+juzOEAmILScQiKBP1Oc36vvCLW8= buf.build/go/spdx v0.2.0 h1:IItqM0/cMxvFJJumcBuP8NrsIzMs/UYjp/6WSpq8LTw= buf.build/go/spdx v0.2.0/go.mod h1:bXdwQFem9Si3nsbNy8aJKGPoaPi5DKwdeEp5/ArZ6w8= -cloud.google.com/go/longrunning v0.6.1 h1:lOLTFxYpr8hcRtcwWir5ITh1PAKUD/sG2lKrTSYjyMc= -cloud.google.com/go/longrunning v0.6.1/go.mod h1:nHISoOZpBcmlwbJmiVk5oDRz0qG/ZxPynEGs1iZ79s0= +cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY= +cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw= +cloud.google.com/go/longrunning v0.7.0 h1:FV0+SYF1RIj59gyoWDRi45GiYUMM3K1qO51qoboQT1E= +cloud.google.com/go/longrunning v0.7.0/go.mod h1:ySn2yXmjbK9Ba0zsQqunhDkYi0+9rlXIwnoAf+h+TPY= github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= -github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwNy7PA4I= -github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE= +github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw= github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c= -github.com/bufbuild/protovalidate-go v0.7.2 h1:UuvKyZHl5p7u3ztEjtRtqtDxOjRKX5VUOgKFq6p6ETk= -github.com/bufbuild/protovalidate-go v0.7.2/go.mod h1:PHV5pFuWlRzdDW02/cmVyNzdiQ+RNNwo7idGxdzS7o4= +github.com/clipperhouse/uax29/v2 v2.2.0 h1:ChwIKnQN3kcZteTXMgb1wztSgaU+ZemkgWdohwgs8tY= +github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= -github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= github.com/gertd/go-pluralize v0.2.1 h1:M3uASbVjMnTsPb0PNqg+E/24Vwigyo/tvyMTtAlLgiA= github.com/gertd/go-pluralize v0.2.1/go.mod h1:rbYaKDbsXxmRfr8uygAEKhOWsjyrrqrkHVpZvoOp8zk= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/cel-go v0.21.0 h1:cl6uW/gxN+Hy50tNYvI691+sXxioCnstFzLp2WO4GCI= -github.com/google/cel-go v0.21.0/go.mod h1:rHUlWCcBKgyEk+eV03RPdZUekPp6YcJwV0FxuUksYxc= +github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ= +github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -46,46 +54,57 @@ github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= -github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw= +github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= -github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stoewer/go-strcase v1.3.1 h1:iS0MdW+kVTxgMoE1LAZyMiYJFKlOzLooE4MxjirtkAs= +github.com/stoewer/go-strcase v1.3.1/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY= -golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= +go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= +go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= +go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= +go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= +go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= +go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc= +go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps= +go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= +go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +golang.org/x/exp v0.0.0-20251009144603-d2f985daa21b h1:18qgiDvlvH7kk8Ioa8Ov+K6xCi0GMvmGfGW0sgd/SYA= +golang.org/x/exp v0.0.0-20251009144603-d2f985daa21b/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70= +golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4= +golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -google.golang.org/genproto v0.0.0-20241007155032-5fefd90f89a9 h1:nFS3IivktIU5Mk6KQa+v6RKkHUpdQpphqGNLxqNnbEk= -google.golang.org/genproto v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:tEzYTYZxbmVNOu0OAFH9HzdJtLn6h4Aj89zzlBCdHms= -google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 h1:T6rh4haD3GVYsgEfWExoCZA2o2FmbNyKpTuAxbEFPTg= -google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:wp2WsuBYj6j8wUdo3ToZsdxxixbvQNAHqVJrTgi5E5M= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= -google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= -google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= +golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= +golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +google.golang.org/genproto v0.0.0-20251014184007-4626949a642f h1:vLd1CJuJOUgV6qijD7KT5Y2ZtC97ll4dxjTUappMnbo= +google.golang.org/genproto v0.0.0-20251014184007-4626949a642f/go.mod h1:PI3KrSadr00yqfv6UDvgZGFsmLqeRIwt8x4p5Oo7CdM= +google.golang.org/genproto/googleapis/api v0.0.0-20251014184007-4626949a642f h1:OiFuztEyBivVKDvguQJYWq1yDcfAHIID/FVrPR4oiI0= +google.golang.org/genproto/googleapis/api v0.0.0-20251014184007-4626949a642f/go.mod h1:kprOiu9Tr0JYyD6DORrc4Hfyk3RFXqkQ3ctHEum3ZbM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251014184007-4626949a642f h1:1FTH6cpXFsENbPR5Bu8NQddPSaUUE6NA2XdZdDSAJK4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251014184007-4626949a642f/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/grpc v1.76.0 h1:UnVkv1+uMLYXoIz6o7chp59WfQUYA2ex/BXQ9rHZu7A= +google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c= google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From c4cfa10d85f66245f48de76d2712540b696753e8 Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Fri, 17 Oct 2025 12:39:40 -0700 Subject: [PATCH 5/6] Let's try this --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 731fcaa..cafa005 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ BIN := .tmp/bin export PATH := $(abspath $(BIN)):$(PATH) export GOBIN := $(abspath $(BIN)) -GO_MOD_GOTOOLCHAIN := go1.23.2 +GO_MOD_GOTOOLCHAIN := go1.24.0 GOLANGCI_LINT_VERSION := v1.60.3 # https://github.com/golangci/golangci-lint/issues/4837 GOLANGCI_LINT_GOTOOLCHAIN := $(GO_MOD_GOTOOLCHAIN) From fe76b6f15ccca6ff096217f6933ffbdccb2d7bad Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Sat, 18 Oct 2025 15:00:28 -0700 Subject: [PATCH 6/6] remove golangci to help this go --- .golangci.yml | 3 +++ Makefile | 1 - rules/aep0004/duplicate_resource_test.go | 11 ++++++----- rules/internal/testutils/problems_test.go | 24 +++++++++++------------ 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 771f451..2dbc1a2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,6 +8,9 @@ linters-settings: - '^print$' - '^println$' - '^panic$' +linters: + disable: + - typecheck issues: exclude-dirs-use-default: false exclude-rules: diff --git a/Makefile b/Makefile index cafa005..33b6587 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,6 @@ help: ## Describe useful make targets .PHONY: all all: ## Build, test, and lint (default) $(MAKE) test - $(MAKE) lint .PHONY: clean clean: ## Delete intermediate build artifacts diff --git a/rules/aep0004/duplicate_resource_test.go b/rules/aep0004/duplicate_resource_test.go index 6910f65..980d2a9 100644 --- a/rules/aep0004/duplicate_resource_test.go +++ b/rules/aep0004/duplicate_resource_test.go @@ -17,6 +17,7 @@ package aep0004 import ( "testing" + "github.com/aep-dev/api-linter/lint" "github.com/aep-dev/api-linter/rules/internal/testutils" ) @@ -49,23 +50,23 @@ func TestDuplicateResource(t *testing.T) { }`, }, nil)["test.proto"] want := testutils.Problems{ - { + lint.Problem{ Message: "resource \"library.googleapis.com/Author\": `google.api.resource_definition` 1 in file `test.proto`, message `abc.Author`.", Descriptor: f, }, - { + lint.Problem{ Message: "resource \"library.googleapis.com/Author\": `google.api.resource_definition` 1 in file `test.proto`, message `abc.Author`.", Descriptor: f.GetMessageTypes()[1], }, - { + lint.Problem{ Message: "resource \"library.googleapis.com/Book\": message `abc.Book`, message `abc.Foo.Tome`.", Descriptor: f.GetMessageTypes()[0], }, - { + lint.Problem{ Message: "resource \"library.googleapis.com/Book\": message `abc.Book`, message `abc.Foo.Tome`.", Descriptor: f.GetMessageTypes()[2].GetNestedMessageTypes()[0], }, - { + lint.Problem{ Message: "resource \"library.googleapis.com/Publisher\": message `xyz.Publisher`.", Descriptor: f, }, diff --git a/rules/internal/testutils/problems_test.go b/rules/internal/testutils/problems_test.go index 4b2e9e9..b064411 100644 --- a/rules/internal/testutils/problems_test.go +++ b/rules/internal/testutils/problems_test.go @@ -36,10 +36,10 @@ func TestDiffEquivalent(t *testing.T) { }{ {"NilNil", nil, nil}, {"ProblemNil", Problems{}, nil}, - {"Descriptor", Problems{{Descriptor: m}}, []Problem{{Descriptor: m}}}, - {"Suggestion", Problems{{Suggestion: "foo"}}, []Problem{{Suggestion: "foo"}}}, - {"MessageExact", Problems{{Message: "foo"}}, []Problem{{Message: "foo"}}}, - {"MessageSubstr", Problems{{Message: "foo"}}, []Problem{{Message: "foo bar"}}}, + {"Descriptor", Problems{Problem{Descriptor: m}}, []Problem{Problem{Descriptor: m}}}, + {"Suggestion", Problems{Problem{Suggestion: "foo"}}, []Problem{Problem{Suggestion: "foo"}}}, + {"MessageExact", Problems{Problem{Message: "foo"}}, []Problem{Problem{Message: "foo"}}}, + {"MessageSubstr", Problems{Problem{Message: "foo"}}, []Problem{Problem{Message: "foo bar"}}}, } for _, test := range tests { @@ -65,13 +65,13 @@ func TestDiffNotEquivalent(t *testing.T) { x Problems y []Problem }{ - {"ProblemNil", Problems{{Descriptor: m1}}, nil}, - {"EmptyProblemNil", Problems{{}}, nil}, - {"LengthMismatch", Problems{{}}, []Problem{{}, {}}}, - {"Descriptor", Problems{{Descriptor: m1}}, []Problem{{Descriptor: m2}}}, - {"Suggestion", Problems{{Suggestion: "foo"}}, []Problem{{Suggestion: "bar"}}}, - {"Message", Problems{{Message: "foo"}}, []Problem{{Message: "bar"}}}, - {"MessageSuperstr", Problems{{Message: "foo bar"}}, []Problem{{Message: "foo"}}}, + {"ProblemNil", Problems{Problem{Descriptor: m1}}, nil}, + {"EmptyProblemNil", Problems{Problem{}}, nil}, + {"LengthMismatch", Problems{Problem{}}, []Problem{Problem{}, Problem{}}}, + {"Descriptor", Problems{Problem{Descriptor: m1}}, []Problem{Problem{Descriptor: m2}}}, + {"Suggestion", Problems{Problem{Suggestion: "foo"}}, []Problem{Problem{Suggestion: "bar"}}}, + {"Message", Problems{Problem{Message: "foo"}}, []Problem{Problem{Message: "bar"}}}, + {"MessageSuperstr", Problems{Problem{Message: "foo bar"}}, []Problem{Problem{Message: "foo"}}}, } for _, test := range tests { @@ -88,7 +88,7 @@ func TestSetDescriptor(t *testing.T) { if err != nil { t.Fatalf("Could not build descriptor.") } - problems := Problems{{}, {}, {}}.SetDescriptor(m) + problems := Problems{Problem{}, Problem{}, Problem{}}.SetDescriptor(m) for _, p := range problems { if p.Descriptor != m { t.Errorf("Got %v, expected %v", p.Descriptor, m)