Expect validation files could be generated with relative path
manhdaovan opened this issue · 1 comments
Context
I have a something.proto
file, and defined go_package
option on it:
// something.proto
syntax = "proto3";
option go_package="github.com/abc/def/ghi/klm/app/service";
And I generated the validation file using protoc
as below:
protoc -I. \
-I$(CURR_DIR)/../vendor/ \
--doc_out=markdown,proto_clip.md:../docs/proto \
--go_out=plugins=grpc,paths=source_relative:../app/service \
--govalidators_out=$(CURR_DIR)/../app/service \
./*.proto;
Note that I used paths=source_relative:../app/service
option (something.pb.go would be placed in relative path to currrent proto files),
then I got a something.validator.pb.proto
at app/service/github.com/abc/def/ghi/klm/app/service/generate_id.validator.pb.go
=> The generated validation file was placed in whole path joined with relative path.
=> Expect: Only app/service/generate_id.validator.pb.go
Desire
This tool support the generated validation files in relative path to as above,
regardless to go_package
option if a relative path is given in command, such as source_relative
, for example.
I changed above protoc command to:
protoc -I. \
-I$(CURR_DIR)/../vendor/ \
--doc_out=markdown,proto_clip.md:../docs/proto \
--go_out=plugins=grpc,paths=source_relative:../app/service \
--govalidators_out=paths=source_relative:../app/service \
./*.proto;
and the source was generated as i expected.