Skip to content

fix(internal/godocfx): make friendlyAPIName tolerant of missing packages#14194

Merged
hongalex merged 3 commits intogoogleapis:mainfrom
hongalex:fix-friendly-api-name-test
Mar 19, 2026
Merged

fix(internal/godocfx): make friendlyAPIName tolerant of missing packages#14194
hongalex merged 3 commits intogoogleapis:mainfrom
hongalex:fix-friendly-api-name-test

Conversation

@hongalex
Copy link
Copy Markdown
Member

friendlyAPIName was recently changed to return an empty string instead of an error when a package or metadata is not found.

This matches the old behavior prior to when fixes were made to account for individual .json files.

Without this change, our tests for alloydbconn, cloudqlconn will fail since they don't .repo-metadata.json files, and also don't live in this repository. In addition, the auth library generation also fails. None of these packages required a friendly API namer in the old behavior.

…ng behavior

friendlyAPIName was recently changed to return an empty string instead of
an error when a package or metadata is not found. This update aligns the
tests with that behavior by:
- Removing the test case for malformed metadata.
- Updating the pubsub test to use a fallback to verify submodule avoidance.
- Removing the unused wantErr field from the test struct.
@hongalex hongalex requested review from a team as code owners March 18, 2026 04:33
@hongalex hongalex changed the title fix(internal/godocfx): make friendlyAPIName tolerant of errors fix(internal/godocfx): make friendlyAPIName tolerant of missing packages Mar 18, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request makes friendlyAPIName more robust by returning an empty string instead of an error when API metadata is not found. This is a sensible change that aligns with the previous behavior and fixes issues with packages lacking metadata files. The changes in internal/godocfx/parse.go and the test adjustments in internal/godocfx/godocfx_test.go are correct. I have one suggestion to enhance the test coverage to more explicitly validate the new error-tolerant logic, aligning with the rule to add tests for potential future errors.

Comment thread internal/godocfx/godocfx_test.go
@hongalex hongalex merged commit d71fd6a into googleapis:main Mar 19, 2026
10 checks passed
@hongalex hongalex deleted the fix-friendly-api-name-test branch March 19, 2026 17:11
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