Skip to content

refactor(sidekick/api): add (*API).Filter - #7966

Open
coryan wants to merge 2 commits into
googleapis:mainfrom
coryan:feat/move-filter-to-types
Open

coryan wants to merge 2 commits into
googleapis:mainfrom
coryan:feat/move-filter-to-types

Conversation

@coryan

@coryan coryan commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Add a generic (*API).Filter method to construct a filtered copy of an API surface.

Later I will use this to make api.API read-only and still select what to filter in the Rust codec.

Part of #7837

Add a generic (*API).Filter method to construct a filtered copy of an

API surface, keeping Rust/prost-specific reachability rules in

internal/librarian/rust/generate_prost_hybrid.go.

Part of googleapis#7837

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

Copy link
Copy Markdown
Contributor

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 refactors the API model filtering logic used in Rust Prost hybrid generation by extracting it from generate_prost_hybrid.go into a reusable Filter method on the API struct, accompanied by new unit tests. The code review feedback highlights several important issues: the Codec field is missing from the filtered API copy, message-level resource definitions are omitted during lookup map population, and a map comparison in the tests will cause a compilation error. Additionally, some test assertions need to be updated to conform to the repository's style guide for cmp.Diff error formatting.

Comment thread internal/sidekick/api/filter.go Resolved
Comment thread internal/sidekick/api/filter.go Resolved
Comment thread internal/sidekick/api/filter_test.go Resolved
Comment thread internal/sidekick/api/filter_test.go Resolved
@coryan
coryan marked this pull request as ready for review November 20, 2026 19:28
@coryan
coryan requested review from a team as code owners November 20, 2026 19:28
@coryan
coryan marked this pull request as draft November 20, 2026 19:29
@coryan
coryan marked this pull request as ready for review November 20, 2026 19:58
@coryan
coryan requested a review from amanda-tarafa November 20, 2026 19:59
@coryan

coryan commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

@amanda-tarafa this is towards the read-only api.T types.

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.

1 participant