-
Notifications
You must be signed in to change notification settings - Fork 57
feat(internal/gengapic): include API version in gapic metadata #1653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(internal/gengapic): include API version in gapic metadata #1653
Conversation
shollyman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The early return behavior feels a bit itchy to me, but I realize that's an inherited behavior from the proto API.
Yeah...it's a bit weird...my feeling was that if something was called out of order we either 1. return an error (not doing that yet today, so seemed a bit overkill) or 2. do nothing, emit nothing The latter seemed preferred as it would be obvious in tests and generated output that something is missing. I'm happy to change it back to the "silently inits its parent" behavior. It would just be "lossy" if called out of order b.c not every scope has access to apiVersion information. |
I've got some intentions wrt init and setup of this plugin so that we validate things a bit more strongly on startup. I'll keep this in mind when I revisit that work. |
coryan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Late I know.
| if md, ok := g.metadata.GetServices()[tst.serv.GetName()]; !ok { | ||
| t.Errorf("ClientInit(%s) gapic metadata, expected %s to be present but found %+v", tst.tstName, tst.serv.GetName(), g.metadata.GetServices()) | ||
| } else if tst.serv == servPlain && md.GetApiVersion() != servPlainAPIVersion { | ||
| t.Errorf("ClinitInit(%s) gapic metadata service entry api version, got %q, want %q", tst.tstName, md.GetApiVersion(), servPlainAPIVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo, ClinitInit -> ClientInit
Pulls out the
google.api.api_versionservice-level annotation and includes it in thegapic_metadata.jsonservicesentry.Also refactors
gapic_metadatageneration to be a little more picky about when things are called because we don't want to silently initialize things and potentially miss adding information we need i.e. theservice-levelApiVersionannotation. This shouldn't be a big deal though because these are always called in a hierarchical way, as the service and then methods are traversed and once for each transport.Internal bug http://b/452365074