@@ -42,7 +42,7 @@ var DeprecatedArgs map[string]error = map[string]error{
4242
4343// SupportedBooleanArgs expose boolean plugin arguments (presence enables option).
4444var SupportedBooleanArgs map [string ]func () configOption = map [string ]func () configOption {
45- "metadata" : enableGAPICMetadata ,
45+ "metadata" : generateGAPICMetadata ,
4646 "diregapic" : generateAsDIREGAPIC ,
4747 "rest-numeric-enums" : enableRESTNumericEnums ,
4848 "omit-snippets" : enableOmitSnippets ,
@@ -82,12 +82,12 @@ type options struct {
8282 outDir string
8383
8484 // Should GAPIC metadata be generated
85- // TODO: rename this in a subsequent refactor
86- metadata bool
85+ generateGAPICMetadata bool
8786
88- // Are the input artifacts from a DIREGAPIC source
89- // TODO: rename this in a subsequent refactor
90- diregapic bool
87+ // Should the generator respect DIREGAPIC limitations
88+ // If the input artifacts are synthetic (e.g. compiled from another IDL source such as a discovery document) then
89+ // some protobuf-behaviors should not be relied upon.
90+ generateAsDIREGAPIC bool
9191
9292 // Should the generator code generator numeric enums for REST calls
9393 // TODO: rename this in a subsquent refactor
@@ -209,7 +209,7 @@ func validateAndNormalizeOptions(cfg *options) error {
209209 }
210210
211211 // REST enums are not supported by DIREGAPIC.
212- if cfg .diregapic && cfg .restNumericEnum {
212+ if cfg .generateAsDIREGAPIC && cfg .restNumericEnum {
213213 return errors .New ("incompatible features: diregapic and rest numeric enums" )
214214 }
215215
@@ -249,10 +249,10 @@ func withGoGAPICPackage(s string) configOption {
249249 }
250250}
251251
252- // enableGAPICMetadata enables generation of GAPIC metadata.
253- func enableGAPICMetadata () configOption {
252+ // generateGAPICMetadata enables generation of GAPIC metadata.
253+ func generateGAPICMetadata () configOption {
254254 return func (cfg * options ) error {
255- cfg .metadata = true
255+ cfg .generateGAPICMetadata = true
256256 return nil
257257 }
258258}
@@ -263,7 +263,7 @@ func enableGAPICMetadata() configOption {
263263// protos (e.g. compute).
264264func generateAsDIREGAPIC () configOption {
265265 return func (cfg * options ) error {
266- cfg .diregapic = true
266+ cfg .generateAsDIREGAPIC = true
267267 return nil
268268 }
269269}
0 commit comments