Skip to content

Commit

Permalink
fix: grpc-gateway file generation
Browse files Browse the repository at this point in the history
Signed-off-by: Sahil Badla <[email protected]>
  • Loading branch information
sahilbadla committed Jan 4, 2024
1 parent 0f08ae1 commit 4b8054c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
8 changes: 4 additions & 4 deletions protobuf/buf.gen.go-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ managed:
enabled: true
plugins:
- plugin: buf.build/protocolbuffers/go
out: ../proto/go-server
out: ./proto/go-server
opt:
- paths=source_relative
- plugin: buf.build/grpc/go:v1.3.0
out: ../proto/go-server
out: ./proto/go-server
opt:
- require_unimplemented_servers=false
- paths=source_relative
- plugin: buf.build/grpc-ecosystem/plugins/grpc-gateway:v2.10.3-1
out: ../proto/go-server
- plugin: buf.build/grpc-ecosystem/gateway:v2.18.1
out: ./proto/go-server
opt:
- paths=source_relative
- generate_unbound_methods=true
20 changes: 18 additions & 2 deletions protobuf/schema/v1/schema.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ package schema.v1;

option go_package = "schema/service/v1";

// well know type by google, gRPC gateway uses HTTP annotation.
import "google/api/annotations.proto";

message AnalyzeRequest {
string backend = 1;
string namespace = 2;
Expand Down Expand Up @@ -116,8 +119,21 @@ message ListIntegrationsResponse {
}

service ServerService {
rpc Analyze(AnalyzeRequest) returns (AnalyzeResponse) {}
rpc Analyze(AnalyzeRequest) returns (AnalyzeResponse) {
// option type is http
option (google.api.http) = {
// this is url, for RESTfull/JSON api and method
// this line means when a HTTP post request comes with "/v1/analyze" call this rpc method over this service
get: "/v1/analyze"
};
}
rpc AddConfig(AddConfigRequest) returns (AddConfigResponse) {}
rpc RemoveConfig(RemoveConfigRequest) returns (RemoveConfigResponse) {}
rpc ListIntegrations(ListIntegrationsRequest) returns (ListIntegrationsResponse) {}
rpc ListIntegrations(ListIntegrationsRequest) returns (ListIntegrationsResponse) {
// option type is http
option (google.api.http) = {
// this line means when a HTTP GET request comes with "/v1/list" call this rpc method over this service
get: "/v1/list"
};
}
}

0 comments on commit 4b8054c

Please sign in to comment.