gapic-generator-ruby icon indicating copy to clipboard operation
gapic-generator-ruby copied to clipboard

Do not look in configuration file for annotation values

Open blowmage opened this issue 6 years ago • 7 comments

Updated:

Currently scopes, default_host, and port can be represented in both the proto annotations and the configuration file. Let's make it so that these values can only be represented by the proto annotations to be more strict with our interface. (@landrito)

The generator should be able to generate a working client without any annotations using reasonable default values (i.e. localhost for host, etc.). (@jbolinger)

Previously: We should only use protoc_options for very high level options, not for specifying package-level configuration. For package-level values we should only look at the annotations and the configuration file (that was specified in the protoc_options).

blowmage avatar Mar 20 '19 20:03 blowmage

I'd also like to make sure that there is no overlap in what can be represented in the annotations and the configuration. Currently scopes, default_host, and port can be represented in both the proto annotations and the configuration file. Let's make it so that these values can only be represented by the proto annotations to be more strict with our interface.

landrito avatar Mar 20 '19 20:03 landrito

We can't generate speech or vision without adding annotation values to the configuration because those protos don't have the annotations yet. The annotations take precedence, but I would not remove the configuration check for those required values until the annotations are more widely used.

blowmage avatar Mar 20 '19 21:03 blowmage

I think it's fine to leave em in until we have them more API's. Internally we are working out a strategy for getting those annotations into all the APIs in googleapis/googleapis. I do want to be strict about the interface to the tool so let's not push to beta until we remove the configuration check for those annotations.

Does that work for you?

landrito avatar Mar 20 '19 21:03 landrito

It does if the intended audience of gapic-generator is only protos that belong to googleapis. (I am assuming all these changes will be pushed upstream from gapic-generator-cloud to gapic-generator.) I wonder if requiring the annotations would be a barrier to using the generator with non-Google protos.

blowmage avatar Mar 20 '19 21:03 blowmage

The intended input of any gapic-generator-{language} in github.com/googleapis are is protos that use the annotations api-common-protos/google/api. This normalizes the interface across all the generators so that users that buy into the proto definition with those annotation benefit by having multiple generators that support it.

landrito avatar Mar 20 '19 21:03 landrito

@blowmage one extra clarification. Everything Ernest said is true. However, the generator should be able to generate a working client without any annotations using reasonable default values (i.e. localhost for host, etc.).

jbolinger avatar Mar 21 '19 17:03 jbolinger

Re-opened as: "Do not look in configuration file for annotation values"

quartzmo avatar Mar 22 '19 15:03 quartzmo