Skip to content

Commit

Permalink
introduce gotags to protobuf for yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
jkralik committed Dec 13, 2022
1 parent ca24aa3 commit 98df2c8
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/plgd-dev/hub/v2
go 1.18

require (
github.com/favadi/protoc-go-inject-tag v1.4.0
github.com/felixge/httpsnoop v1.0.3
github.com/fsnotify/fsnotify v1.6.0
github.com/fullstorydev/grpchan v1.1.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/favadi/protoc-go-inject-tag v1.4.0 h1:K3KXxbgRw5WT4f43LbglARGz/8jVsDOS7uMjG4oNvXY=
github.com/favadi/protoc-go-inject-tag v1.4.0/go.mod h1:AZ+PK+QDKUOLlBRG0rYiKkUX5Hw7+7GTFzlU99GFSbQ=
github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
Expand Down
1 change: 1 addition & 0 deletions grpc-gateway/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ GRPCGATEWAY_MODULE_PATH := $(shell go list -m -f '{{.Dir}}' github.com/grpc-ecos

proto/generate:
protoc -I=. -I=$(REPOSITORY_DIRECTORY) -I=$(GOPATH)/src --go_out=$(GOPATH)/src $(WORKING_DIRECTORY)/pb/hubConfiguration.proto
protoc-go-inject-tag -input=$(WORKING_DIRECTORY)/pb/hubConfiguration.pb.go
protoc -I=. -I=$(REPOSITORY_DIRECTORY) -I=$(GOPATH)/src --go_out=$(GOPATH)/src $(WORKING_DIRECTORY)/pb/devices.proto
protoc -I=. -I=$(REPOSITORY_DIRECTORY) -I=$(GOPATH)/src --go_out=$(GOPATH)/src $(WORKING_DIRECTORY)/pb/events.proto
protoc -I=. -I=$(REPOSITORY_DIRECTORY) -I=$(GOPATH)/src --go_out=$(GOPATH)/src $(WORKING_DIRECTORY)/pb/getDevicesMetadata.proto
Expand Down
6 changes: 3 additions & 3 deletions grpc-gateway/pb/hubConfiguration.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions grpc-gateway/pb/hubConfiguration.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ message HubConfigurationRequest {
}

message WebOAuthClient {
string client_id = 1;
string client_id = 1; // @gotags: yaml:"clientID"
string audience = 2;
repeated string scopes = 3;
}


message DeviceOAuthClient {
string client_id = 1;
string client_id = 1; // @gotags: yaml:"clientID"
string audience = 2;
repeated string scopes = 3;
string provider_name = 4;
string provider_name = 4; // @gotags: yaml:"providerName"
}

message HubConfigurationResponse {
Expand Down
2 changes: 2 additions & 0 deletions tools/tools.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
//go:build tools
// +build tools

package tools

import (
_ "github.com/favadi/protoc-go-inject-tag"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2"
_ "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
Expand Down

0 comments on commit 98df2c8

Please sign in to comment.