Skip to content
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(gengapic): add support for AutoPopulatedFields UUID4 #1460

Merged
merged 14 commits into from
Feb 20, 2024

Conversation

quartzmo
Copy link
Member

No description provided.

@quartzmo quartzmo requested review from a team as code owners February 14, 2024 16:53
@quartzmo quartzmo force-pushed the gengapic-autopopulatedfields branch from 503ad10 to 754ab1b Compare February 14, 2024 17:18
Copy link
Collaborator

@noahdietz noahdietz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are adding a net new dependency to generated code, can you also include the dep for bazel here: https://github.com/googleapis/gapic-generator-go/blob/main/rules_go_gapic/go_gapic.bzl#L156-L157

"@com_github_google_uuid//:go_default_library" I think should do it.

internal/gengapic/generator.go Outdated Show resolved Hide resolved
internal/gengapic/generator.go Outdated Show resolved Hide resolved
internal/gengapic/generator.go Outdated Show resolved Hide resolved
internal/gengapic/gengapic.go Show resolved Hide resolved
internal/gengapic/gengapic.go Outdated Show resolved Hide resolved
internal/gengapic/gengapic.go Outdated Show resolved Hide resolved
internal/gengapic/gengapic_test.go Show resolved Hide resolved
@quartzmo
Copy link
Member Author

@noahdietz Updated with the UUID dependency, thank you.

I locally ran the bazel targets for the "usual suspects" set of gapic libraries:

bazelisk build //google/cloud/apigeeconnect/v1:apigeeconnect_go_gapic
bazelisk build //google/cloud/asset/v1:asset_go_gapic
bazelisk build //google/cloud/language/v1:language_go_gapic
bazelisk build //google/spanner/v1:spanner_go_gapic
bazelisk build //google/cloud/aiplatform/v1beta1:aiplatform_go_gapic
bazelisk build //google/cloud/compute/v1:compute_go_gapic

internal/gengapic/generator.go Outdated Show resolved Hide resolved
internal/gengapic/generator.go Outdated Show resolved Hide resolved
internal/gengapic/generator_test.go Show resolved Hide resolved
internal/gengapic/generator_test.go Outdated Show resolved Hide resolved
internal/gengapic/generator_test.go Outdated Show resolved Hide resolved
p("if req != nil && req.%s == nil {", f)
} else {
// Type will be string if field does not have explicit presence.
p("if req != nil && req.%s == \"\" {", f)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
p("if req != nil && req.%s == \"\" {", f)
p("if req != nil && req.Get%s() == \"\" {", f)

But we may want to use buildAccessor to get this string instead of just doing snakeToCmael...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with buildAccessor, PTAL, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the update .want files to verify the output now looks good, thanks!

internal/gengapic/gengapic.go Outdated Show resolved Hide resolved
internal/gengapic/gengapic.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@noahdietz noahdietz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry @quartzmo I should've been more explicit in my comments

internal/gengapic/generator.go Outdated Show resolved Hide resolved
internal/gengapic/gengapic.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@noahdietz noahdietz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM great work and thanks for your patience with my review. Add that test we spoke about offline and you are good to go.

@quartzmo quartzmo merged commit 2f3b7b9 into googleapis:main Feb 20, 2024
7 checks passed
@quartzmo quartzmo deleted the gengapic-autopopulatedfields branch February 20, 2024 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants