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

Protobuf code generator (command) #107

Merged
merged 14 commits into from
Aug 19, 2020
Merged

Protobuf code generator (command) #107

merged 14 commits into from
Aug 19, 2020

Conversation

Alma-media
Copy link
Member

@Alma-media Alma-media commented Aug 14, 2020

Related to #73

semaphore.greeter.Say@127.0.0.1:50051> show service
+---------+-------+-----------------+------------------+
| SERVICE |  RPC  |  REQUEST TYPE   |  RESPONSE TYPE   |
+---------+-------+-----------------+------------------+
| Say     | Hello | SayHelloRequest | SayHelloResponse |
+---------+-------+-----------------+------------------+
$ go run main.go generate protobuf  -f ../../examples/grpc/gateway/config.hcl 
syntax = "proto2";

package semaphore.greeter;

message SayHelloRequest {
  optional string name = 1;
}

message SayHelloResponse {
  optional string msg = 1;

  optional metaNested meta = 2;

  message metaNested {
    optional int64 session = 1;
  }
}

service Say {
  rpc Hello ( SayHelloRequest ) returns ( SayHelloResponse );
}

@Alma-media Alma-media self-assigned this Aug 14, 2020
Base automatically changed from refactor/core to master August 14, 2020 14:21
@codecov-commenter
Copy link

codecov-commenter commented Aug 14, 2020

Codecov Report

Merging #107 into master will increase coverage by 0.14%.
The diff coverage is 79.16%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #107      +/-   ##
==========================================
+ Coverage   84.46%   84.60%   +0.14%     
==========================================
  Files          70       70              
  Lines        4409     4398      -11     
==========================================
- Hits         3724     3721       -3     
+ Misses        425      420       -5     
+ Partials      260      257       -3     
Impacted Files Coverage Δ
pkg/codec/proto/service.go 57.14% <57.14%> (ø)
pkg/transport/grpc/reflection.go 53.06% <83.33%> (+1.99%) ⬆️
pkg/transport/grpc/listener.go 76.85% <93.10%> (+1.85%) ⬆️
pkg/transport/grpc/caller.go 75.00% <100.00%> (+0.84%) ⬆️
pkg/transport/grpc/method.go 84.61% <100.00%> (ø)

Copy link
Contributor

@jeroenrinzema jeroenrinzema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the new structs and interfaces implementations. I just got two small comments.

@Alma-media Alma-media marked this pull request as ready for review August 18, 2020 11:28

func init() {
Command.PersistentFlags().StringSliceVar(&params.Protobuffers, "proto", []string{}, "If set are all proto definitions found inside the given path passed as schema definitions, all proto definitions are also passed as imports")
Command.PersistentFlags().StringSliceVarP(&params.Files, "file", "f", []string{"config.hcl"}, "Parses the given file as a definition file")
Command.PersistentFlags().StringVar(&params.LogLevel, "level", "warn", "Global logging level, this value will override the defined log level inside the file definitions")
Command.PersistentFlags().StringVarP(&output, "output", "o", "", "Output directory")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is a good idea to add a small warning that all missing directories are created?

@jeroenrinzema jeroenrinzema merged commit 299048e into master Aug 19, 2020
@jeroenrinzema jeroenrinzema deleted the proto-gen branch August 19, 2020 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants