GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Draft: Selective api poc by zhumin8 · Pull Request #3129 · googleapis/sdk-platform-java

This repository was archived by the owner on Oct 29, 2026. It is now read-only.

Conversation

@zhumin8

@zhumin8 zhumin8 commented Aug 21, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

DO NOT MERGE.
This is a draft pr as prototype to changes for selective api generation feature.
The changes in this pr include api-common-java changes copied over manually for testing purposes.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
zhumin8 added 5 commits August 12, 2024 16:55
@zhumin8
temp: local generate java-common-protos from googleapis with client.p…
c20c974
…roto changes.
@zhumin8
poc for typical cases on selective generation.
cbcd5bc
@zhumin8
minor fixes and add comments.
cf87622
@zhumin8
temp commit: needs cleanups - experimenting with resources.:
e877473
@zhumin8
add composer test to verify methods in client generated.
a89bb9f
@product-auto-label product-auto-label Bot added the size: xl Pull request size is extra large. label Aug 21, 2024
@zhumin8 zhumin8 added do not merge Indicates a pull request not ready for merge, due to either quality or timing. and removed size: xl Pull request size is extra large. labels Aug 21, 2024
zhumin8
zhumin8 commented Aug 21, 2024
View reviewed changes
Comment thread gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/ComposerTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

zhumin8
zhumin8 commented Aug 23, 2024
View reviewed changes
Comment thread gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

zhumin8
zhumin8 commented Aug 23, 2024
View reviewed changes
Comment thread gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@zhumin8
fix service yaml library_settings.version. add verification that it m…
7dcdf56
…atches proto package in parser. other cleanups and minor fixes.
@product-auto-label product-auto-label Bot added the size: xl Pull request size is extra large. label Aug 23, 2024
zhumin8 added 5 commits August 23, 2024 10:55
@zhumin8
minor code cleanups.
f47c93a
@zhumin8
add note about cleanups for message and resource names parsing.
2496716
@zhumin8
rename method name.
c29a319
@zhumin8
minor fix: use parent interface.
7d8480a
@zhumin8
update test proto and config comments and namings.
395fa47
zhumin8
zhumin8 commented Aug 23, 2024
View reviewed changes
Comment thread gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@zhumin8 zhumin8 removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Aug 26, 2024
blakeli0
blakeli0 reviewed Aug 28, 2024
View reviewed changes
Comment thread gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java
serviceDescriptor -> {
List<MethodDescriptor> methodsList = serviceDescriptor.getMethods();
if (methodsList.isEmpty()) {
List<MethodDescriptor> methodListSelected =

@blakeli0 blakeli0 Aug 28, 2024

Copy link
Copy Markdown
Contributor

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 scenario is in case that all methods from a service are excluded?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@zhumin8 zhumin8 Aug 29, 2024

Copy link
Copy Markdown
Contributor Author

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.

Yes. And this is likely now e.g. in vertexai's requirement it only exposes methods from 2 services.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java Outdated
}

private static Optional<List<String>> getInclusionMethodListFromServiceYaml(
Optional<com.google.api.Service> serviceYamlProtoOpt, String protoPackage) {

@blakeli0 blakeli0 Aug 28, 2024

Copy link
Copy Markdown
Contributor

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.

It is usually preferred to not passing around Optional if we can check it before calling the method.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@zhumin8 zhumin8 Aug 30, 2024

Copy link
Copy Markdown
Contributor Author

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.

I want to follow-up on this from our discussion earlier and get @blakeli0 your opinion on this. (FYI, I've combined this method into shouldIncludeMethodInGeneration() )
For now, I am slightly inclined to keep this Optional<com.google.api.Service> serviceYamlProtoOpt as input for 2 reasons:

  • The pattern of passing in this Optional is repeated in this Parser class, a larger scale refactor is needed to remove these.
  • Because this service yaml is an optional config file that only some libraries have, it sort of make sense to have this Optional representation. And I find the current way can better encapsulate this piece of logic: shouldIncludeMethodInGeneration() has all the information to decide if this method should or not be included. I could check serviceYamlProtoOpt before calling the method, but the 2 occurrences would repeat the logic in a reverse way, and it might be less readable for debugging in the future.

Does this makes sense to you? WDYT?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

zhumin8 added 5 commits August 30, 2024 14:18
@zhumin8
review comments, combining methods for readability.
950069e
@zhumin8
minor cleanup.
fa63021
@zhumin8
update ComposerTest to check on non-included methods.
e013458
@zhumin8
update test.
5a89def
@zhumin8
move test for helper resource name from ComposerTest to ProtoTest.
a99af2c
zhumin8
zhumin8 commented Aug 30, 2024
View reviewed changes
Comment thread gapic-generator-java/src/test/java/com/google/api/generator/gapic/protoparser/ParserTest.java
}

@Test
void selectiveGenerationTest_shouldExcludeUnusedResourceNames() {

@zhumin8 zhumin8 Aug 30, 2024

Copy link
Copy Markdown
Contributor Author

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 test verifies that unused resource names (associated with methods not in inclusion list) will not be populated to GapicContext.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
blakeli0
blakeli0 reviewed Sep 11, 2024
View reviewed changes
Comment thread gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread gapic-generator-java/src/test/proto/selective_api_generation.proto Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread gapic-generator-java/src/main/java/com/google/api/generator/gapic/protoparser/Parser.java Outdated
Transport.GRPC);
}

private static boolean shouldIncludeMethodInGeneration(

@blakeli0 blakeli0 Sep 11, 2024

Copy link
Copy Markdown
Contributor

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.

Can we make this a default scope method so we can test it directly? This would enabled us testing more scenarios like the non matching packages, it would also simplify the golden tests.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread gapic-generator-java/src/test/java/com/google/api/generator/gapic/composer/ComposerTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread gapic-generator-java/src/test/resources/selective_api_generation_no_java_settings_v1beta1.yaml Outdated

@blakeli0 blakeli0 Sep 11, 2024

Copy link
Copy Markdown
Contributor

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 probably don't need this yaml and selective_api_generation_no_publishing_v1beta1.yaml as the scenarios should be tested in ParserTest directly.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
zhumin8 added 2 commits September 13, 2024 16:18
@zhumin8
review feedback, log warning text.
e8f5388
@zhumin8
fix regression when combining logic in 950069e.
2012a82
zhumin8 added 3 commits September 13, 2024 22:20
@zhumin8
trim proto for test. rm composer test.
7978c15
@zhumin8
expose private method to test, add test for version mismatch, add moc…
c2967e9
…kito dep.
@zhumin8
trying to refactor 2 parser tests with mockito mocks.
819bdd5
@zhumin8 zhumin8 mentioned this pull request Oct 29, 2024
feat: enable selective generation based on service config include list #3323
Merged
zhumin8 added a commit that referenced this pull request Nov 5, 2024
@zhumin8
feat: enable selective generation based on service config include list (
0cddadb
#3323)

following changes in client.proto that propagated to `ClientProto.java`
([pr](https://github.com/googleapis/sdk-platform-java/pull/3309/files#diff-44c330ef5cfa380744be6c58a14aa543edceb6043d5b17da7b32bb728ef5d85f)),
apply changes from poc pr
(#3129).

For context:
[go/selective-api-gen-java-one-pager](http://goto.google.com/selective-api-gen-java-one-pager),
b/356380016
@zhumin8

zhumin8 commented Nov 7, 2024

Copy link
Copy Markdown
Contributor Author

implemented in #3323. closing

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@zhumin8 zhumin8 closed this Nov 7, 2024
chingor13 pushed a commit to googleapis/google-cloud-java that referenced this pull request Mar 24, 2026
@zhumin8
feat: enable selective generation based on service config include list (
e4dd181
#3323)

following changes in client.proto that propagated to `ClientProto.java`
([pr](https://github.com/googleapis/sdk-platform-java/pull/3309/files#diff-44c330ef5cfa380744be6c58a14aa543edceb6043d5b17da7b32bb728ef5d85f)),
apply changes from poc pr
(googleapis/sdk-platform-java#3129).

For context:
[go/selective-api-gen-java-one-pager](http://goto.google.com/selective-api-gen-java-one-pager),
b/356380016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@blakeli0 blakeli0 blakeli0 left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size: xl Pull request size is extra large.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@zhumin8 @blakeli0
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.