-
Notifications
You must be signed in to change notification settings - Fork 69
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
fix: add default library settings for incorrect lib version #2212
Conversation
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.
LGTM once a unit test is added that fails without the fix
result[self.naming.proto_package] = client_pb2.ClientLibrarySettings( | ||
version=self.naming.proto_package | ||
) |
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.
result[self.naming.proto_package] = client_pb2.ClientLibrarySettings( | |
version=self.naming.proto_package | |
) | |
result[self.naming.proto_package] = client_pb2.ClientLibrarySettings( | |
version=self.naming.proto_package | |
) |
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.
this results in the style check to fail.
# - if library_settings.version != self.naming.proto_package (proto package name) | ||
if self.naming.proto_package not in result: | ||
result[self.naming.proto_package] = client_pb2.ClientLibrarySettings( | ||
version=self.naming.proto_package |
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.
To confirm, you're not passing python_settings
here like you are in line 704 because we intend to pass empty settings since they weren't explicitly specified for self.naming.proto_package
version?
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.
We want to set empty settings against self.naming.proto_package
if the key is not already set in line 704 which happens only when someone has an incorrect library_settings.version
configured in their service yaml. We're doing this so our generator doesn't if it fails to find the settings that it's looking for.
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.
Sg. You're confirming the intent I phrased, so I understood correctly. Thanks!
consider the case where
self.naming.proto_package
differs fromlibrary_settings.version
. Ideally, this shouldn't happen but if the version configured againstlibrary_settings.version
is incorrect, it breaks our generator.As an example, see: https://github.com/googleapis/googleapis/blob/master/google/cloud/confidentialcomputing/v1alpha1/confidentialcomputing_v1alpha1.yaml#L63 where the service yaml file for confidentialcomputing specifies an incorrect version for library settings.
In this case:
self.naming.proto_package = google.cloud.confidentialcomputing.v1alpha1
library_settings.version = google.cloud.confidentialcomputing.v1