Skip to content
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

feat: add example of non-working global grpc_api_configuration file #3062

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ proto:
--template ./examples/internal/proto/examplepb/visibility_rule_preview_and_internal_echo_service.buf.gen.yaml \
--path examples/internal/proto/examplepb/visibility_rule_echo_service.proto
mv examples/internal/proto/examplepb/visibility_rule_echo_service.swagger.json examples/internal/proto/examplepb/visibility_rule_preview_and_internal_echo_service.swagger.json
buf generate \
--template ./examples/internal/proto/globalconfig/globalconfig.buf.gen.yaml \
--path examples/internal/proto/globalconfig

generate: proto $(ECHO_EXAMPLE_SRCS) $(ABE_EXAMPLE_SRCS) $(UNANNOTATED_ECHO_EXAMPLE_SRCS) $(RESPONSE_BODY_EXAMPLE_SRCS) $(GENERATE_UNBOUND_METHODS_EXAMPLE_SRCS)

Expand Down
17 changes: 17 additions & 0 deletions examples/internal/proto/globalconfig/first_svc/v1/first_svc.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";

package grpc.gateway.examples.internal.proto.globalconfig.first_svc.v1;

option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/globalconfig/first_svc/v1;first_svcv1";

service FirstService {
rpc Get(GetRequest) returns (GetResponse) {}
}

message GetRequest {
string request = 1;
}

message GetResponse {
string response = 1;
}
11 changes: 11 additions & 0 deletions examples/internal/proto/globalconfig/globalconfig.buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: v1
plugins:
- name: grpc-gateway
out: .
opt:
- paths=source_relative
- grpc_api_configuration=examples/internal/proto/globalconfig/grpc_annotations.yaml
johanbrandhorst marked this conversation as resolved.
Show resolved Hide resolved
- name: openapiv2
out: .
opt:
- grpc_api_configuration=examples/internal/proto/globalconfig/grpc_annotations.yaml
12 changes: 12 additions & 0 deletions examples/internal/proto/globalconfig/grpc_annotations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type: google.api.Service
config_version: 3

http:
rules:
### First service ###
- selector: api.first_svc.v1.FirstService.Get
gvencadze marked this conversation as resolved.
Show resolved Hide resolved
get: /api/v1/first/get

### Second service ###
- selector: api.second_svc.v1.SecondService.Get
gvencadze marked this conversation as resolved.
Show resolved Hide resolved
get: /api/v2/second/get
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";

package grpc.gateway.examples.internal.proto.globalconfig.second_svc.v1;

option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/globalconfig/second_svc/v1;second_svcv1";

service SecondService {
rpc Get(GetRequest) returns (GetResponse) {}
}

message GetRequest {
string request = 1;
}

message GetResponse {
string response = 1;
}