feat(sidekick/surfer): prefix nested message flag names with parent names#5805
Merged
jameslynnwu merged 1 commit intoMay 7, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new logic for deriving argument flag names in the argumentBuilder. The deriveArgName method ensures that nested fields have unique and contextual names by prepending parent field names while stripping redundant API request boilerplate, such as request message names or explicit body field names. The changes include the implementation in argument_builder.go, corresponding unit tests in argument_builder_test.go, and updated expected output in several YAML test data files. I have no feedback to provide.
sarahheacock
reviewed
May 5, 2026
0ec17b3 to
232f2d7
Compare
232f2d7 to
618120d
Compare
618120d to
cadef8e
Compare
sarahheacock
reviewed
May 6, 2026
sarahheacock
approved these changes
May 6, 2026
…ames Surfer now prepends parent field names to generated gcloud flag names for fields inside nested messages, preventing collisions and matching gen_sfc behavior. To support this robustly, the internal generator representation was refactored to represent nested field paths using rich api.Field descriptors instead of raw string JSON names. This decoupled representation allows the generator to calculate CLI flag names (using snake_case proto Names) and API wire payload paths (using camelCase JSONNames) independently and cleanly, solving a latent bug where custom json_name options would incorrectly leak into CLI flags. Fixes googleapis#5511
cadef8e to
019b2bf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Surfer now prepends parent field names to generated gcloud flag names for fields inside nested messages, preventing collisions and matching gen_sfc behavior.
The new logic derives the flag name from the API field path and applies rules to strip request message names and explicit body field names, avoiding redundant prefixes. This logic is encapsulated in a new deriveArgName helper function.
Fixes #5511