git clone https://github.com/envoyproxy/protoc-gen-validate.git cd protoc-gen-validate 编译源码: bash make build 这将生成 protoc-gen-validate 可执行文件。4. 验证安装是否成功 安装完成后,您可以通过以下命令验证 protoc-gen-validate 是否可用: ...
1.克隆地址 git clone git@github.com:bufbuild/protoc-gen-validate.git 2.然后 makebuild 即可,在你的bin 下面就会有这个可执行文件 原文在:https://github.com/bufbuild/protoc-gen-validate?tab=readme-ov-file#build-from-source的Build from source中也说了...
p:=new(Person)err:=p.Validate()// err: Id must be greater than 999p.Id=1000err=p.Validate()// err: Email must be a valid email addressp.Email="example@lyft.com"err=p.Validate()// err: Name must match pattern '^[^\d\s]+( [^\d\s]+)*$'p.Name="Protocol Buffer"err=p.V...
err := p.Validate()// err: Id must be greater than 999p.Id =1000err = p.Validate()// err: Email must be a valid email addressp.Email ="example@bufbuild.com"err = p.Validate()// err: Name must match pattern '^[^\d\s]+( [^\d\s]+)*$'p.Name ="Protocol Buffer"err = ...
</protocArtifact> </configuration> <execution> <id>protoc-java-pgv</id> <goals> <goal>compile-custom</goal> </goals> <configuration> <pluginParameter>lang=java</pluginParameter> <pluginId>java-pgv</pluginId> <pluginArtifact>io.envoyproxy.protoc-gen-validate:protoc-gen-validate:${pgv.version...
git clone https://github.com/bufbuild/protoc-gen-validate.git # installs PGV into $GOPATH/bin cd protoc-gen-validate && make build Parameters lang: specify the target language to generate. Currently, the only supported options are:
import"validate/validate.proto";message Person { uint64 id = 1 [(validate.rules).uint64.gt = 999];string email = 2 [(validate.rules).string.email = true];string name = 3 [(validate.rules).string = { pattern: "^[^[0-9]A-Za-z]+( [^[0-9]A-Za-z]+)*$",max_by...
validate BUILD validate.h validate.pb.go validate.proto vendor windows .dockerignore .gitignore .travis.yml BUILD CODE_OF_CONDUCT.md Dockerfile Gopkg.lock Gopkg.toml LICENSE Makefile README.md WORKSPACE main.go rule_comparison.md Latest commit ...
问题描述protoc-gen-validate插件不能生成验证代码 命令: 1 protoc -I . helloworld.proto --go_out=. --go-grpc_out=require_unimplemented_servers=false:. --validate_out="lang=go:../generated" 控制台错误: 1 2 [error] unable to convert ..\proto\helloworld.pb.validate.go to proto: generator ...
\ -I ${GOPATH}/src \ -I ${GOPATH}/src/github.com/envoyproxy/protoc-gen-validate \ --gogofast_out=":../generated"\ --validate_out="lang=gogo:../generated" \ example.proto Gogo support has the following limitations: only gogofast plugin is supported and tested, meaning that the ...