Skip to content

feat: Selective gapic generation phase II #3730

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

Merged
merged 27 commits into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
595198b
feat: Selective gapic generation phase II
cindy-peng Apr 1, 2025
f5c93db
Add selective gapic yaml files and golden files
cindy-peng Apr 2, 2025
734efa9
add golden test files
cindy-peng Apr 2, 2025
fbb19ea
Revert service client throw comment
cindy-peng Apr 2, 2025
03220b9
Revert integration golden files
cindy-peng Apr 2, 2025
c516814
Merge branch 'main' into cindy/selective-gapic
cindy-peng Apr 2, 2025
55de64f
Merge branch 'main' into cindy/selective-gapic
cindy-peng Apr 3, 2025
27bdc9e
Merge branch 'main' into cindy/selective-gapic
cindy-peng Apr 7, 2025
1f77302
Remove enum from method model
cindy-peng Apr 7, 2025
eb0c6bf
Set default method level to be public
cindy-peng Apr 7, 2025
5a21be7
Fix formatting errors
cindy-peng Apr 7, 2025
5fad1fe
Change isPublic attribute to isInternalApi in method class
cindy-peng Apr 10, 2025
182a517
Merge branch 'main' into cindy/selective-gapic
cindy-peng Apr 10, 2025
221eb8f
Fix linter
cindy-peng Apr 10, 2025
ffd66db
Fix comments from PR review.
cindy-peng Apr 15, 2025
602b910
Merge branch 'main' into cindy/selective-gapic
cindy-peng Apr 15, 2025
a87d3b0
Fix linter.
cindy-peng Apr 15, 2025
cbb7ce5
Add unit tests for stub, stub settings,service settings
cindy-peng Apr 16, 2025
6c30173
Fix Javadoc comment line break before @InternalApi comment
cindy-peng Apr 16, 2025
b481cc7
Change block tag to start with lowercase to resolve formatter issue.
cindy-peng Apr 16, 2025
edafba1
Fix comment to be lowercase @internalApi
cindy-peng Apr 16, 2025
f4c9cf7
Change internalApi javadoc comment to be additional descriptive text.
cindy-peng Apr 17, 2025
385873d
Merge branch 'main' into cindy/selective-gapic
cindy-peng Apr 17, 2025
7c3aeaa
Add common string and unit tests for parser.
cindy-peng Apr 17, 2025
b0553ac
Add common string and unit tests for parser.
cindy-peng Apr 17, 2025
01bc7f7
Change internal use warning message.
cindy-peng Apr 17, 2025
2ece35b
Fix linter formatting.
cindy-peng Apr 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@ static Stream<Arguments> data() {
"EchoSettings",
TestProtoLoader.instance().parseShowcaseEcho(),
"localhost:7469",
"v1beta1"),
"v1beta1",
0),
Arguments.of(
"DeprecatedServiceSettings",
TestProtoLoader.instance().parseDeprecatedService(),
"localhost:7469",
"v1"));
"v1",
0),
Arguments.of(
"EchoServiceSelectiveGapicServiceSettings",
TestProtoLoader.instance().parseSelectiveGenerationTesting(),
"localhost:7469",
"v1beta1",
1));
}

@ParameterizedTest
Expand All @@ -46,8 +54,9 @@ void generateServiceSettingsClasses(
String name,
GapicContext context,
String apiShortNameExpected,
String packageVersionExpected) {
Service service = context.services().get(0);
String packageVersionExpected,
int serviceIndex) {
Service service = context.services().get(serviceIndex);
GapicClass clazz = ServiceSettingsClassComposer.instance().generate(context, service);

Assert.assertGoldenClass(this.getClass(), clazz, name + ".golden");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,19 @@
class ServiceStubClassComposerTest {
static Stream<Arguments> data() {
return Stream.of(
Arguments.of("EchoStub", TestProtoLoader.instance().parseShowcaseEcho(), "", ""),
Arguments.of("EchoStub", TestProtoLoader.instance().parseShowcaseEcho(), "", "", 0),
Arguments.of(
"DeprecatedServiceStub", TestProtoLoader.instance().parseDeprecatedService(), "", ""));
"DeprecatedServiceStub",
TestProtoLoader.instance().parseDeprecatedService(),
"",
"",
0),
Arguments.of(
"EchoServiceSelectiveGapicClientStub",
TestProtoLoader.instance().parseSelectiveGenerationTesting(),
"",
"",
1));
}

@ParameterizedTest
Expand All @@ -38,8 +48,9 @@ void generateServiceStubClasses(
String name,
GapicContext context,
String apiShortNameExpected,
String packageVersionExpected) {
Service service = context.services().get(0);
String packageVersionExpected,
int serviceIndex) {
Service service = context.services().get(serviceIndex);
GapicClass clazz = ServiceStubClassComposer.instance().generate(context, service);

Assert.assertGoldenClass(this.getClass(), clazz, name + ".golden");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,38 @@ static Stream<Arguments> data() {
"LoggingServiceV2StubSettings",
GrpcTestProtoLoader.instance().parseLogging(),
"logging",
"v2"),
"v2",
0),
Arguments.of(
"PublisherStubSettings",
GrpcTestProtoLoader.instance().parsePubSubPublisher(),
"pubsub",
"v1"),
"v1",
0),
Arguments.of(
"EchoStubSettings",
GrpcTestProtoLoader.instance().parseShowcaseEcho(),
"localhost:7469",
"v1beta1"),
"v1beta1",
0),
Arguments.of(
"DeprecatedServiceStubSettings",
GrpcTestProtoLoader.instance().parseDeprecatedService(),
"localhost:7469",
"v1"),
"v1",
0),
Arguments.of(
"ApiVersionTestingStubSettings",
GrpcTestProtoLoader.instance().parseApiVersionTesting(),
"localhost:7469",
"v1"));
"v1",
0),
Arguments.of(
"EchoServiceSelectiveGapicStubSettings",
GrpcTestProtoLoader.instance().parseSelectiveGenerationTesting(),
"localhost:7469",
"v1beta1",
1));
}

@ParameterizedTest
Expand All @@ -60,8 +71,9 @@ void generateServiceStubSettingsClasses(
String name,
GapicContext context,
String apiShortNameExpected,
String packageVersionExpected) {
Service service = context.services().get(0);
String packageVersionExpected,
int serviceIndex) {
Service service = context.services().get(serviceIndex);
GapicClass clazz = ServiceStubSettingsClassComposer.instance().generate(context, service);

Assert.assertGoldenClass(this.getClass(), clazz, name + ".golden");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.google.selective.generate.v1beta1.stub;

import com.google.api.core.BetaApi;
import com.google.api.core.InternalApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.BidiStreamingCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.selective.generate.v1beta1.EchoRequest;
import com.google.selective.generate.v1beta1.EchoResponse;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Base stub class for the EchoServiceShouldGeneratePartialUsual service API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
@BetaApi
@Generated("by gapic-generator-java")
public abstract class EchoServiceShouldGeneratePartialUsualStub implements BackgroundResource {

public UnaryCallable<EchoRequest, EchoResponse> echoShouldGenerateAsUsualCallable() {
throw new UnsupportedOperationException("Not implemented: echoShouldGenerateAsUsualCallable()");
}

public BidiStreamingCallable<EchoRequest, EchoResponse> chatShouldGenerateAsUsualCallable() {
throw new UnsupportedOperationException("Not implemented: chatShouldGenerateAsUsualCallable()");
}

public BidiStreamingCallable<EchoRequest, EchoResponse> chatAgainShouldGenerateAsUsualCallable() {
throw new UnsupportedOperationException(
"Not implemented: chatAgainShouldGenerateAsUsualCallable()");
}

@InternalApi("Internal API. This API is not intended for public consumption.")
public UnaryCallable<EchoRequest, EchoResponse> chatShouldGenerateAsInternalCallable() {
throw new UnsupportedOperationException(
"Not implemented: chatShouldGenerateAsInternalCallable()");
}

@InternalApi("Internal API. This API is not intended for public consumption.")
public BidiStreamingCallable<EchoRequest, EchoResponse> echoShouldGenerateAsInternalCallable() {
throw new UnsupportedOperationException(
"Not implemented: echoShouldGenerateAsInternalCallable()");
}

@Override
public abstract void close();
}
Loading
Loading