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

How to specify path for generated validator.go ? #121

Open
pkumarex opened this issue Jul 8, 2022 · 2 comments
Open

How to specify path for generated validator.go ? #121

pkumarex opened this issue Jul 8, 2022 · 2 comments

Comments

@pkumarex
Copy link

pkumarex commented Jul 8, 2022

I am trying to include request validation for grpc. I modified the protobuf command like this. pkg/test/test.proto contains my schema. If i run the below command :

protoc --go_out=. \
--proto_path=${GOPATH}/src \
--proto_path=${GOPATH}/src/github.com/gogo/protobuf/gogoproto/ \
--proto_path=${GOPATH}/src/github.com/mwitkow/go-proto-validators/ \
--proto_path=. \ --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative pkg/test/test.proto --govalidators_out=. 

The validator.go file generated file is not generated inside pkg/test instead it is getting generated inside a new folder created {source relative pkg}/pkg/test/test.proto/validator.go

How to generate validator.go file without the folder structure in pkg/test ?

@pkumarex pkumarex changed the title How to specify path for generated validator.go How to specify path for generated validator.go ? Jul 8, 2022
@skamenetskiy
Copy link

+1

@skamenetskiy
Copy link

--govalidators_opt=paths=source_relative

worked for me.

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

No branches or pull requests

2 participants