googleapis/api-linter

Add rule to validate field doesn't have both proto3 "optional" and "REQUIRED" annotation

Closed this issue · 0 comments

gapic-generator errors on fields that have both the protoe3 optional keyword and a (google.api.field_behavior) = REQUIRED annotation.

For example, given the following field definition in a .proto file:

  optional string language = 14 [(google.api.field_behavior) = REQUIRED];

The following error occurs during GAPIC generation:

ERROR: toplevel: oneof field language cannot be required (in method GenerateKeywordIdeas)

It would be good to have linter rules for API-203 flag this.