-
Notifications
You must be signed in to change notification settings - Fork 71
fix: Generator to skip generation for empty services. #3051
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7c6239f
fix: filter on methods not empty when parsing services.
zhumin8 c1b2aab
fix: cleanup and simplify.
zhumin8 e6aa0ab
fix: cleanup code.
zhumin8 001f5e4
fix: reverts related changes in #985 that partially allows empty serv…
zhumin8 dde1659
fix: update test proto comment.
zhumin8 a1898a9
update log wording.
zhumin8 c851d49
review comment: rm unused service from proto for test.
zhumin8 ac26d78
update golden showcase files to fix native test failure.
zhumin8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
154 changes: 0 additions & 154 deletions
154
...a/src/test/java/com/google/api/generator/gapic/composer/grpcrest/goldens/EchoEmpty.golden
This file was deleted.
Oops, something went wrong.
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
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
131 changes: 131 additions & 0 deletions
131
gapic-generator-java/src/test/proto/service_with_no_methods.proto
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| // Copyright 2018 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // https://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| syntax = "proto3"; | ||
|
|
||
| import "google/api/annotations.proto"; | ||
| import "google/api/client.proto"; | ||
| import "google/api/field_behavior.proto"; | ||
| import "google/api/field_info.proto"; | ||
| import "google/api/resource.proto"; | ||
| import "google/longrunning/operations.proto"; | ||
| import "google/protobuf/duration.proto"; | ||
| import "google/protobuf/timestamp.proto"; | ||
| import "google/rpc/status.proto"; | ||
|
|
||
| package google.api.service.without.methods.test.v1; | ||
|
|
||
| option java_package = "com.google.api.service.without.methods.test"; | ||
| option java_multiple_files = true; | ||
| option java_outer_classname = "ServiceWithNoMethodsOuterClass"; | ||
|
|
||
| option (google.api.resource_definition) = { | ||
| type: "showcase.googleapis.com/AnythingGoes" | ||
| pattern: "*" | ||
| }; | ||
| // This proto is used to test scenarios where a service does not have any rpc methods | ||
|
|
||
| // This service is used as control group when it is not empty. | ||
| service EchoWithMethods { | ||
| // This service is meant to only run locally on the port 7469 (keypad digits | ||
| // for "show"). | ||
| option (google.api.default_host) = "localhost:7469"; | ||
| option (google.api.oauth_scopes) = | ||
| "https://www.googleapis.com/auth/cloud-platform"; | ||
|
|
||
| // This method simply echos the request. This method is showcases unary rpcs. | ||
| rpc EchoWithMethod(EchoRequest) returns (EchoResponse) { | ||
| option (google.api.http) = { | ||
| post: "/v1beta1/echo:echo" | ||
| body: "*" | ||
| }; | ||
| option (google.api.method_signature) = "content"; | ||
| option (google.api.method_signature) = "error"; | ||
| option (google.api.method_signature) = "content,severity"; | ||
| option (google.api.method_signature) = "name"; | ||
| option (google.api.method_signature) = "parent"; | ||
| option (google.api.method_signature) = ""; | ||
| } | ||
| } | ||
|
|
||
| // This service is to test when no method specified. | ||
| service EchoWithoutMethods { | ||
| // This service is meant to only run locally on the port 7469 (keypad digits | ||
| // for "show"). | ||
| option (google.api.default_host) = "localhost:7469"; | ||
| option (google.api.oauth_scopes) = | ||
| "https://www.googleapis.com/auth/cloud-platform"; | ||
| } | ||
|
|
||
| // A severity enum used to test enum capabilities in GAPIC surfaces | ||
| enum Severity { | ||
| UNNECESSARY = 0; | ||
| NECESSARY = 1; | ||
| URGENT = 2; | ||
| CRITICAL = 3; | ||
| } | ||
|
|
||
| message Foobar { | ||
| option (google.api.resource) = { | ||
| type: "showcase.googleapis.com/Foobar" | ||
| pattern: "projects/{project}/foobars/{foobar}" | ||
| pattern: "projects/{project}/chocolate/variants/{variant}/foobars/{foobar}" | ||
| pattern: "foobars/{foobar}" | ||
| pattern: "bar_foos/{bar_foo}/foobars/{foobar}" | ||
| pattern: "*" | ||
| }; | ||
|
|
||
| string name = 1; | ||
| string info = 2; | ||
| } | ||
|
|
||
| // The request message used for the Echo, Collect and Chat methods. | ||
| // If content or opt are set in this message then the request will succeed. | ||
| // If status is set in this message | ||
| // then the status will be returned as an error. | ||
| message EchoRequest { | ||
| string name = 5 [ | ||
| (google.api.resource_reference).type = "showcase.googleapis.com/Foobar", | ||
| (google.api.field_behavior) = REQUIRED | ||
| ]; | ||
|
|
||
| string parent = 6 [ | ||
| (google.api.resource_reference).child_type = | ||
| "showcase.googleapis.com/AnythingGoes", | ||
| (google.api.field_behavior) = REQUIRED | ||
| ]; | ||
|
|
||
| oneof response { | ||
| // The content to be echoed by the server. | ||
| string content = 1; | ||
|
|
||
| // The error to be thrown by the server. | ||
| google.rpc.Status error = 2; | ||
| } | ||
|
|
||
| // The severity to be echoed by the server. | ||
| Severity severity = 3; | ||
|
|
||
| Foobar foobar = 4; | ||
| } | ||
|
|
||
| // The response message for the Echo methods. | ||
| message EchoResponse { | ||
| // The content specified in the request. | ||
| string content = 1; | ||
|
|
||
| // The severity specified in the request. | ||
| Severity severity = 2; | ||
| } | ||
|
|
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
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.
Uh oh!
There was an error while loading. Please reload this page.