Proto commits in bufbuild/protoc-gen-validate

These 85 commits are when the Protocol Buffers files have changed:

Commit:b378b1f
Author:Morteza PRK
Committer:GitHub

Support `in` rule for repeated `int32` and `int64` fields (#1241) Second part of the #1240 This PR adds support for `in` rule for `repeated int32/int64` fields for C Updated the testcases Co-authored-by: Chris Roche <github@rodaine.com>

The documentation is generated from this commit.

Commit:80ccd3e
Author:wineandchord
Committer:GitHub

validate: fix typos (#999)

Commit:4e25f91
Author:Elbek Khoshimjonov
Committer:GitHub

Fix Import collisions (take default imports into an account) (#859)

Commit:c87857e
Author:taichi uchihara
Committer:GitHub

Fix invalid generation when using in-rule and not_in rule in map.keys.string (#847) ## Summary I fixed invalid generation for Go and cc when using in-rule and not_in rule in map.keys.string ## Issue Closes https://github.com/bufbuild/protoc-gen-validate/issues/785 --------- Co-authored-by: Chris Roche <github@rodaine.com>

Commit:a3c8c99
Author:Jayson Wang
Committer:GitHub

Properly handling of enum imports (#839) 1. properly importing enums from multiple packages/namespaces with the same name(in/not in rules) 2. reduce unnecessary duplication of import and alias For example, a proto with this message ```proto ... import "foo/v1/datatype.proto" import "bar/v1/datatype.proto" ... message CreateSomethingRequest { foo.v1.Foo.FooType foo_type = 1 [(validate.rules).enum = {in: [1, 2, 3, 4]}]; bar.v1.Bar.BarType bar_type = 2 [(validate.rules).enum = {not_in: [1, 2, 3, 4]}]; } ``` and run `go vet ./...` in generated code ```plain # example.com/buf-pgv/zoo/api/v1 vet: zoo/api/v1/zoo.pb.validate.go:187:46: undeclared name: v1 ```

Commit:1b8cba9
Author:stitch cula
Committer:GitHub

Fix generating lookup for repeated.items.any.in (#553) Signed-off-by: StitchCula <stitchgl@outlook.com> Signed-off-by: StitchCula <stitchgl@outlook.com> Co-authored-by: Chris Roche <github@rodaine.com> Co-authored-by: Elliot Jackson <elliot@elliotmjackson.com>

Commit:61feee2
Author:James Fish
Committer:GitHub

Fix indentation of python templates with ignore_empty (#613) Signed-off-by: James Fish <jfish@pinterest.com> Signed-off-by: James Fish <jfish@pinterest.com>

Commit:4694024
Author:Matt Klein
Committer:GitHub

C++: Fix polymorphic lookup and add tests (#576) The previous iteration does not make ASAN happy because of the implicit static cast between Message and concrete type. This PR reverts that change, adds a new abstract validation registry, and explicitly performs a dynamic cast when asked to do so. It also checks to make sure a validator exists for the passed in message. Also add a .clang-format so at least manual formatting can be done. Signed-off-by: Matt Klein <mklein@lyft.com>

Commit:0f87cc3
Author:Matt Klein
Committer:GitHub

go: more regression fixes for optional values (#575) Signed-off-by: Matt Klein <mklein@lyft.com>

Commit:7518d9e
Author:Matt Klein
Committer:GitHub

enum: fix another regression inside of oneof (#574) Need to use Value() to remove any pointer in the case of an optionally present field. Signed-off-by: Matt Klein <mklein@lyft.com>

Commit:3898097
Author:Matt Klein
Committer:GitHub

Various small fixes (#573) * Various small fixes 1) Fix regression from https://github.com/envoyproxy/protoc-gen-validate/pull/529. The code needs to handle enums at file scope and in a message. At the same time also handle arbitrary nesting. 2) Fix regression from https://github.com/envoyproxy/protoc-gen-validate/pull/537 when dealing with single element string oneofs (and possibly other types being returned as pointer types vs. value types and breaking in queries. This fixes that for both C++ and Go. It's possible this fix shoudl be in PG* but doing it here for simplicity. 3) Modify the C++ validator registry to have polymorphic lookup capability which I want to use in Envoy. Signed-off-by: Matt Klein <mklein@lyft.com> * fix Signed-off-by: Matt Klein <mklein@lyft.com> * fix Signed-off-by: Matt Klein <mklein@lyft.com>

Commit:dc51e59
Author:Mitchell Bundy
Committer:GitHub

Feature/add optional support (#537) * pgs: support proto3 presence & bump go.mod (#431) Signed-off-by: Sarthak Gupta <signed@sarthak.sh> * bump lyft/protoc-gen-start to v0.6.0 Signed-off-by: Mitchell Bundy <mitchell.bundy@unity3d.com> * bump protoc-gen-star to 0.6.0 in bazel dependencies Signed-off-by: Mitchell Bundy <mitchell.bundy@unity3d.com> * add 'optional.proto' file to test harness Signed-off-by: Mitchell Bundy <mitchell.bundy@unity3d.com> * add supported feature optional to go init Signed-off-by: Mitchell Bundy <mitchell.bundy@unity3d.com> * add types/pluginpb to list of deps in BUILD Signed-off-by: Mitchell Bundy <mitchell.bundy@unity3d.com> * bump protobuf in bazel deps to match go.mod version, add deps to BUILD Signed-off-by: Mitchell Bundy <mitchell.bundy@unity3d.com> * bump com_google_protobuf to v3.15.3, matches go-protobuf v1.27 dependency Signed-off-by: Mitchell Bundy <mitchell.bundy@unity3d.com> * update optional test to include optional int64 field within message Signed-off-by: Mitchell Bundy <mitchell.bundy@unity3d.com> * add some test cases to try out Signed-off-by: Mitchell Bundy <mitchell.bundy@unity3d.com> * remove optionalCases from cases Signed-off-by: Mitchell Bundy <mitchell.bundy@unity3d.com> Co-authored-by: Sarthak Gupta <signed@sarthak.sh> Co-authored-by: Ryan Michela <rmichela@salesforce.com>

Commit:e762321
Author:John Rinehart
Committer:GitHub

doc: correct comment describing string.len_bytes (#543) Signed-off-by: John Rinehart <john.rinehart@ardanlabs.com> Co-authored-by: John Rinehart <john.rinehart@ardanlabs.com>

Commit:74a9a1f
Author:Upils
Committer:GitHub

Fix enum import in repeated field (#529) * Add missing import for enum Signed-off-by: Paul MARS <paul.mars@intrinsec.com> * Add a harness for enum import Signed-off-by: Paul MARS <paul.mars@intrinsec.com> * 🐛 Fix enum import path Signed-off-by: Paul MARS <paul.mars@intrinsec.com> * 🐛 Missing java conf for yet_another_package Signed-off-by: Paul MARS <paul.mars@intrinsec.com> * 🎨 Avoid unecessary use of import Signed-off-by: Paul MARS <paul.mars@intrinsec.com>

Commit:8c0f637
Author:Alex Konradi
Committer:GitHub

Perform Go map key sorting inside a scope (#522) This allows defining local variables without them conflicting with other local variables for the same parent message. This patch also adds a test case to prevent regressions in the future. Signed-off-by: Alex Konradi <akonradi@google.com>

Commit:338a2fb
Author:Bert Van Hauwaert
Committer:GitHub

Allow to detect wellknown types in nested messages (#505) * detect wellknown types in nested messages Signed-off-by: Bert Van Hauwaert <bert@becoded.be> * revert Makefile Signed-off-by: Bert Van Hauwaert <bert@becoded.be> * Revert bumping resoruces / deps Signed-off-by: Bert Van Hauwaert <bert@becoded.be> * revert tests go.mod and validate version Signed-off-by: Bert Van Hauwaert <bert@becoded.be> * revert clean up unused Signed-off-by: Bert Van Hauwaert <bert@becoded.be>

Commit:ff16dc3
Author:Daniel Hochman
Committer:GitHub

go: multi-error validation with ValidateAll() (#468) * Revert "Revert 455 (#465)" This reverts commit 758c5fc3a13b71bdb7e851b0c1ee8f6232e0ce7d. Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com> * restore legacy method signature Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com> * move to ValidateAll and update templates Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com> * update comments Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com> * update README Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com> * update test harness Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com> * trailing whitespace Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com> * update comment Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com> * remaining mentions of old method Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com> * fix auto updated imports by editor Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com> * readd go to bazel BUILD Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com> * Update README.md Signed-off-by: Daniel Hochman <danielhochman@users.noreply.github.com>

Commit:758c5fc
Author:Alex Konradi
Committer:GitHub

Revert 455 (#465) * Revert "go: enable multi-error validation (#47) (#455)" This reverts commit 6ca6c537664a5ca0d292ca98a0bb913d14a7876e. Signed-off-by: Alex Konradi <akonradi@google.com> * Add missing Go tests back These tests were dropped unintentionally Signed-off-by: Alex Konradi <akonradi@google.com>

Commit:30badb6
Author:Matthew Crenshaw
Committer:GitHub

eliminates usage of old github.com/google/protobuf libraries, updates… (#459) * eliminates usage of old github.com/google/protobuf libraries, updates to google.golang.org/protobuf 1.5.2 Signed-off-by: Matthew Crenshaw <mcrenshaw@clearstreet.io> * fix remaining references Signed-off-by: Matthew Crenshaw <mcrenshaw@clearstreet.io> * make gazelle Signed-off-by: Matthew Crenshaw <mcrenshaw@clearstreet.io> * go mod tidy in tests Signed-off-by: Matthew Crenshaw <mcrenshaw@clearstreet.io> * go mod tidy in tests Signed-off-by: Matthew Crenshaw <mcrenshaw@clearstreet.io> * update Dockerfile Signed-off-by: Matthew Crenshaw <mcrenshaw@clearstreet.io>

Commit:978fc60
Author:Torbjørn Vatn
Committer:GitHub

Module parameter support (#415) * Add support for module parameter Signed-off-by: Torbjørn Vatn <torbjorn.vatn@unacast.com> * Out path must be relative Signed-off-by: Torbjørn Vatn <torbjorn.vatn@unacast.com> * Add a short description to the README Signed-off-by: Torbjørn Vatn <torbjorn.vatn@unacast.com> * update other_package pkg and make to use module param Signed-off-by: Matthew Crenshaw <mcrenshaw@clearstreet.io> * fix make clean Signed-off-by: Matthew Crenshaw <mcrenshaw@clearstreet.io> Co-authored-by: Matthew Crenshaw <mcrenshaw@clearstreet.io>

Commit:6ca6c53
Author:Mateusz Czapliński
Committer:GitHub

go: enable multi-error validation (#47) (#455) * go: add bool arg to Validate (#47) In generated messages, modify the Validate func to take bool argument. In a later commit, this will be used to distinguish "fail on first error" mode from "extensively find as many as possible errors". Signed-off-by: Mateusz Czapliński <mateusz.czaplinski@wpengine.com> * go: enable multi-error validation (#47) Modify the templates to allow retrieving multiple errors from a Validate func, not just stopping on the first one. Signed-off-by: Mateusz Czapliński <mateusz.czaplinski@wpengine.com> * tests: prepare harness for multi-errors (#47) In test harness executor, add support for languages which can find multiple validation errors at once. Signed-off-by: Mateusz Czapliński <mateusz.czaplinski@wpengine.com> * go: test multi-error validation (#47) Signed-off-by: Mateusz Czapliński <mateusz.czaplinski@wpengine.com> * go tests: check if multi-error was returned (#47) Ensure that a non-nil response from Validate(true) always fulfills the "multi-error" interface (has AllErrors() method). Signed-off-by: Mateusz Czapliński <mateusz.czaplinski@wpengine.com> * go tests: compare 1st msg of multi-error (#47) Compare the first message returned by Validate(true) to the one returned by Validate(false). Signed-off-by: Mateusz Czapliński <mateusz.czaplinski@wpengine.com> * go tests: repeated TestResult.Reasons field (#74) Signed-off-by: Mateusz Czapliński <mateusz.czaplinski@wpengine.com> * tests: fix TestResult.Reasons in non-Go tests (#74) After modifying the harness.proto in an earlier commit, non-Go harnesses broke and need to be adjusted. Signed-off-by: Mateusz Czapliński <mateusz.czaplinski@wpengine.com>

Commit:bfe3839
Author:James Fish
Committer:GitHub

Fix indentation in python codegen for required oneof (#452) Signed-off-by: James Fish <jfish@pinterest.com>

Commit:f5198b1
Author:Alex Konradi
Committer:GitHub

Add an example workspace for Bazel users (#439) Add a subdirectory that functions as an independent Bazel workspace for PGV. This serves both as an example of how to use PGV with Bazel and as a place to put integration tests for behaviors like the one fixed in #437. Fixes #438 Co-authored-by: htuch <htuch@users.noreply.github.com>

Commit:c7b588c
Author:Alex Konradi
Committer:GitHub

Support proto files in subdirectories of the package directory (#436) The existing code assumed that all input .proto files were in the same directory as the BUILD file for the build rule. This isn't always the case, since it's perfectly legal to reference files in a subdirectory that doesn't have its own BUILD file. Signed-off-by: Alex Konradi <akonradi@google.com>

Commit:b212fd4
Author:Darragh Bailey
Committer:GitHub

Ignore empty option (#412) * Introduce ignore_empty option Signed-off-by: Maxim Chechel <hexdigest@gmail.com> * Add support for C and python languages Signed-off-by: Darragh Bailey <dbailey@hpe.com> * Align with updated template formatting Signed-off-by: Darragh Bailey <dbailey@hpe.com> * Add IgnoreEmpty template entries for Java Signed-off-by: Darragh Bailey <dbailey@hpe.com> * Sync with latest updates Signed-off-by: Darragh Bailey <dbailey@hpe.com> * Add some doc examples to the readme Signed-off-by: Darragh Bailey <dbailey@hpe.com> Co-authored-by: Maxim Chechel <hexdigest@gmail.com> Co-authored-by: Chris Roche <github@rodaine.com> Co-authored-by: Mark Rawlings <Mark.Rawlings@hpe.com>

Commit:538267e
Author:Cody A. Ray
Committer:GitHub

Add ignore constraint to prevent generating Validate function (#374) * Add ignore constraint to prevent generating Validate function Signed-off-by: Cody A. Ray <cody@confluent.io> * add ignored support for c++ java and python Signed-off-by: Cody A. Ray <cody@confluent.io> * fix for java, I hope Signed-off-by: Cody A. Ray <cody@confluent.io> * fix java template Signed-off-by: Cody A. Ray <cody@confluent.io> * try to fix c++ Signed-off-by: Cody A. Ray <cody@confluent.io> * another fix for C++ Signed-off-by: Cody A. Ray <cody@confluent.io> * try update c++ harness to ignore MessageIgnored class Signed-off-by: Cody A. Ray <cody@confluent.io> * typo Signed-off-by: Cody A. Ray <cody@confluent.io> * guess and check Signed-off-by: Cody A. Ray <cody@confluent.io> * exclude ignored messages from X_TESTS_HARNESS_CASES_MESSAGES Signed-off-by: Cody A. Ray <cody@confluent.io> * touch makefile to kickoff CI Signed-off-by: Cody A. Ray <cody@confluent.io>

Commit:936a121
Author:Alex Konradi
Committer:GitHub

Fix C++ oneof validation with _number in name (#380) The camelCase implementation that PGS uses doesn't replace underscores before numbers, but the protobuf C++ code generator does. Fix and add a test case. Fixes #372 Signed-off-by: Alex Konradi <akonradi@google.com>

Commit:829eef3
Author:zeromberto
Committer:GitHub

Fix support for repeated embedded enums inclusion check in go (#379) Fix code generation for Go for repeated.items.enum.{in, not_in} validations, and add test cases. Fixes #377 Signed-off-by: zeromberto <ze.romberto@gmail.com>

Commit:d2f9a12
Author:Roman Volosatovs
Committer:GitHub

go.{mod,sum}: Update google/protobuf (#371) * go.{mod,sum}: Update google/protobuf Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * tests: Test new repeated option syntax Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>

Commit:622a81e
Author:dominiquehunziker
Committer:GitHub

fix timestamp comparison for greater than now & within (#358) * fix timestamp comparison for greater than now within Signed-off-by: Dominique Hunziker <dominique.hunziker@gmail.com> * also fix comparison issues in Python Signed-off-by: Dominique Hunziker <dominique.hunziker@gmail.com>

Commit:0af61d9
Author:wozz
Committer:GitHub

removes vendor dir (#346) * remove vendor dir Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * fix BUILD Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * update ci golang version Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> Co-authored-by: michael.wozniak <michael.wozniak@snapchat.com>

Commit:c7c8be4
Author:wozz
Committer:GitHub

Remove gogo support (#340) * update vendor dir Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * updates for go.mod Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * updates Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * add net/context as dependency to support building tests based on vendor dir Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * add dep for make target Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * removes gogo support Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * add back bazel files Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * revert some upgrades Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> Co-authored-by: michael.wozniak <michael.wozniak@snapchat.com>

Commit:bd816e4
Author:wozz
Committer:GitHub

Support go modules (#339) * update vendor dir Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * updates for go.mod Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * updates Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * add net/context as dependency to support building tests based on vendor dir Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * add dep for make target Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> * fix makefile Signed-off-by: michael.wozniak <michael.wozniak@snapchat.com> Co-authored-by: michael.wozniak <michael.wozniak@snapchat.com>

Commit:478e95e
Author:Alex Konradi
Committer:GitHub

Fix support for repeated enums inclusion check (#330) Generate code for C++ and Go for repeated.items.enum.{in, not_in} validations, and add test cases. Fixes #329 Signed-off-by: Alex Konradi <akonradi@google.com>

Commit:ab56c3d
Author:asraa
Committer:GitHub

add common regex pattern against \r\n\0 (#323) Adds a known regex that matches Envoy's valid() to use in header-related config fields that would catch this assert. See envoyproxy/envoy#10318 Signed-off-by: Asra Ali <asraa@google.com>

Commit:61843ae
Author:asraa
Committer:GitHub

Add HTTP header well known type and C++ UUID (#297) * add HTTP header well known type and C++ UUID Signed-off-by: Asra Ali <asraa@google.com> * update validate.pb.go Signed-off-by: Asra Ali <asraa@google.com> * simplify conditions Signed-off-by: Asra Ali <asraa@google.com> * fix java build Signed-off-by: Asra Ali <asraa@google.com> * bad test Signed-off-by: Asra Ali <asraa@google.com> * java Signed-off-by: Asra Ali <asraa@google.com> * check for slashes in hdr name Signed-off-by: Asra Ali <asraa@google.com> * add more testcases Signed-off-by: Asra Ali <asraa@google.com> * empty Signed-off-by: Asra Ali <asraa@google.com> * define regex for http header name/value Signed-off-by: Asra Ali <asraa@google.com> * make patterns in to well known regex Signed-off-by: Asra Ali <asraa@google.com> * fix bazel Signed-off-by: Asra Ali <asraa@google.com> * fix bazel maven_jar defn Signed-off-by: Asra Ali <asraa@google.com> * remove fixes for build Signed-off-by: Asra Ali <asraa@google.com> * fix merge mistake Signed-off-by: Asra Ali <asraa@google.com> * encode in utf-8 when writing out Signed-off-by: Asra Ali <asraa@google.com> * cleanup Signed-off-by: Asra Ali <asraa@google.com> * remove unused regex definitions Signed-off-by: Asra Ali <asraa@google.com> * add backtick Signed-off-by: Asra Ali <asraa@google.com> * simplify header value regex as blacklist Signed-off-by: Asra Ali <asraa@google.com> * fixup to match entire string + also fixup dependency Signed-off-by: Asra Ali <asraa@google.com> * python regex Signed-off-by: Asra Ali <asraa@google.com> * remove pyc Signed-off-by: Asra Ali <asraa@google.com> * there's gotta be another way Signed-off-by: Asra Ali <asraa@google.com> * remove autosaved pgs Signed-off-by: Asra Ali <asraa@google.com> Co-authored-by: Alex Konradi <akonradi@google.com>

Commit:cc1ae43
Author:Maksim N
Committer:GitHub

Add _validateUuid method for optional string wrapper (#315) Signed-off-by: Maksim Naumov <maksim@naumov.org>

Commit:fced6c0
Author:Brice Jaglin
Committer:Ryan Michela

java: append correct literal suffix for map keys/values constraints (#294) Without specific handling for maps in `javaTypeLiteralSuffixFor`, no literal suffix was ever appended, resulting in compilation error in the validator for constraints on (Java) long, float or double. This commit mimics the structure of `javaTypeFor` to infer the suffix based on whether keys or values are targeted. Signed-off-by: Brice Jaglin <bjaglin@teads.tv> Co-authored-by: Ryan Michela <rmichela@salesforce.com>

Commit:b1589ae
Author:Eitan Yarmush
Committer:Ryan Michela

updated gogoproto (#301) Signed-off-by: EItanya <eitan.yarmush@solo.io> Co-authored-by: Ryan Michela <rmichela@salesforce.com>

Commit:1a0abed
Author:Stephan Zuercher
Committer:Chris Roche

c++: recursively validate values in map fields (#281) * c++: recursively validate values in map fields Additionally, provides details for unimplemented validation features and adds some generated, but not executed, test cases for C++. Fixes some small errors in the Docker- and Makefiles. Signed-off-by: Stephan Zuercher <zuercher@gmail.com> * remove Makefile fix -- shadow at master and go1.10 are not compatible Signed-off-by: Stephan Zuercher <zuercher@gmail.com> * remove debug flag Signed-off-by: Stephan Zuercher <zuercher@gmail.com> * recursive map validation test case, fix bug Signed-off-by: Stephan Zuercher <zuercher@gmail.com> * fix python Signed-off-by: Stephan Zuercher <zuercher@gmail.com>

Commit:4f00761
Author:asraa
Committer:Chris Roche

add new validation type not_contains (#253) * initial not_contains validator Signed-off-by: Asra Ali <asraa@google.com> * add README comment and fix validate.pb.go Signed-off-by: Asra Ali <asraa@google.com> * fix test labels and proto package Signed-off-by: Asra Ali <asraa@google.com> * generate validate.pb.go with v1.2.0 protoc-gen-go Signed-off-by: Asra Ali <asraa@google.com> * add python not_contains Signed-off-by: Asra Ali <asraa@google.com> * update Signed-off-by: Asra Ali <asraa@google.com>

Commit:fd7de02
Author:Dhi Aurrahman
Committer:Alex Konradi

cc: Convert base file name to screaming snake case (#272) * cc: Convert base file name to screaming snake case This patch converts the base file name into screaming snake case instead of upper for cc macro generation. This is motivated by: INFO: From Compiling external/com_github_openzipkin_zipkinapi/zipkin-jsonv2.pb.validate.cc: In file included from bazel-out/k8-opt/bin/external/com_github_openzipkin_zipkinapi/zipkin-jsonv2.pb.validate.cc:5: bazel-out/k8-opt/bin/external/com_github_openzipkin_zipkinapi/zipkin-jsonv2.pb.validate.h:37:31: warning: ISO C99 requires whitespace after the macro name [-Wc99-extensions] ^ 1 warning generated. As reported in https://github.com/envoyproxy/envoy/pull/6985#issuecomment-526658473. Signed-off-by: Dhi Aurrahman <dio@tetrate.io> * Simple basename replacement Signed-off-by: Dhi Aurrahman <dio@tetrate.io> * Remove noise Signed-off-by: Dhi Aurrahman <dio@tetrate.io> * Remove upper, since it is not being used Signed-off-by: Dhi Aurrahman <dio@tetrate.io>

Commit:a6d40ce
Author:Aditya Kothari
Committer:Chris Roche

Remaining Python Rules (#261) * String, Bool, Num, Global (disabled) Signed-off-by: Aditya Kothari <akothari@lyft.com> * Message rules Signed-off-by: Aditya Kothari <akothari@lyft.com> * finished string rules Signed-off-by: Aditya Kothari <akothari@lyft.com> * Duration Rules completed Signed-off-by: Aditya Kothari <akothari@lyft.com> * Timestamp rules Signed-off-by: Aditya Kothari <akothari@lyft.com> * Wrapper rules Signed-off-by: Aditya Kothari <akothari@lyft.com> * Comments addressed, fixed tests Signed-off-by: Aditya Kothari <akothari@lyft.com> * Print generated code Signed-off-by: Aditya Kothari <akothari@lyft.com> * Add test case Signed-off-by: Aditya Kothari <akothari@lyft.com> * Enum Rules added Signed-off-by: Aditya Kothari <akothari@lyft.com> * Tests python 3 as well Signed-off-by: Aditya Kothari <akothari@lyft.com> * Remaining rules Signed-off-by: Aditya Kothari <akothari@lyft.com>

Commit:e736f5d
Author:Aditya Kothari
Committer:Chris Roche

Python Support (#238) * Pull MessageRules out of oneof FieldRules (#213) * add idea to gitignore Signed-off-by: Aditya Kothari <akothari@lyft.com> * add required as a field rule to ensure nullability Signed-off-by: Aditya Kothari <akothari@lyft.com> * unimplemented flag for c++ Signed-off-by: Aditya Kothari <akothari@lyft.com> * add import to build bazel Signed-off-by: Aditya Kothari <akothari@lyft.com> * ignore java Signed-off-by: Aditya Kothari <akothari@lyft.com> * fix syntax Signed-off-by: Aditya Kothari <akothari@lyft.com> * fix error Signed-off-by: Aditya Kothari <akothari@lyft.com> * fix java exception Signed-off-by: Aditya Kothari <akothari@lyft.com> * fix fail statement Signed-off-by: Aditya Kothari <akothari@lyft.com> * Pull message rules out Signed-off-by: Aditya Kothari <akothari@lyft.com> * fix tests Signed-off-by: Aditya Kothari <akothari@lyft.com> * undo style change Signed-off-by: Aditya Kothari <akothari@lyft.com> * removing messagerules Signed-off-by: Aditya Kothari <akothari@lyft.com> * use messagerules inside rulecontext Signed-off-by: Aditya Kothari <akothari@lyft.com> * remove generated files Signed-off-by: Aditya Kothari <akothari@lyft.com> * prevent use of non-scalar wkts with message rules Signed-off-by: Aditya Kothari <akothari@lyft.com> * Unnecessary change Signed-off-by: Aditya Kothari <akothari@lyft.com> * add float rules Signed-off-by: Aditya Kothari <akothari@lyft.com> * C++ support Signed-off-by: Aditya Kothari <akothari@lyft.com> * java support Signed-off-by: Aditya Kothari <akothari@lyft.com> * Update docs Signed-off-by: Aditya Kothari <akothari@lyft.com> * Changes updated Signed-off-by: Aditya Kothari <akothari@lyft.com> * fixing javabuild Signed-off-by: Aditya Kothari <akothari@lyft.com> * Fix file permission Signed-off-by: Aditya Kothari <akothari@lyft.com> Signed-off-by: Aditya Kothari <akothari@lyft.com> * String, Bool, Num, Global (disabled) Signed-off-by: Aditya Kothari <akothari@lyft.com> * Message rules Signed-off-by: Aditya Kothari <akothari@lyft.com> * finished string rules Signed-off-by: Aditya Kothari <akothari@lyft.com> * Duration Rules completed Signed-off-by: Aditya Kothari <akothari@lyft.com> * Timestamp rules Signed-off-by: Aditya Kothari <akothari@lyft.com> * Wrapper rules Signed-off-by: Aditya Kothari <akothari@lyft.com> * Comments addressed, fixed tests Signed-off-by: Aditya Kothari <akothari@lyft.com> * Print generated code Signed-off-by: Aditya Kothari <akothari@lyft.com> * Add test case Signed-off-by: Aditya Kothari <akothari@lyft.com> * Enum Rules added Signed-off-by: Aditya Kothari <akothari@lyft.com> * Tests python 3 as well Signed-off-by: Aditya Kothari <akothari@lyft.com> * any rules Signed-off-by: Aditya Kothari <akothari@lyft.com>

Commit:ee0f8c7
Author:Sam Xie
Committer:Chris Roche

add missing go_package (#252) Signed-off-by: Sam Xie <xsambundy@gmail.com>

Commit:0966440
Author:Cynthia Coan
Committer:Ryan Michela

regression test for multiple_java_files (#245) this adds in a regression test for the multiple_java_files option trying to generate java files even when java wasn't an output. this test breaks before the fix, but works on master since the fix is in play. Signed-off-by: Cynthia Coan <ccoan@instructure.com>

Commit:a9c7c98
Author:Ryan Michela
Committer:GitHub

Correctly handle underscores when java multiple files is true (#234) * Correctly handle underscores when java multiple files is true Signed-off-by: Ryan Michela <rmichela@salesforce.com> * s/ReplaceAll/Replace/ Signed-off-by: Ryan Michela <rmichela@salesforce.com>

Commit:dbe039e
Author:Aditya Kothari
Committer:Chris Roche

Pull MessageRules out of oneof FieldRules (#213) * add idea to gitignore Signed-off-by: Aditya Kothari <akothari@lyft.com> * add required as a field rule to ensure nullability Signed-off-by: Aditya Kothari <akothari@lyft.com> * unimplemented flag for c++ Signed-off-by: Aditya Kothari <akothari@lyft.com> * add import to build bazel Signed-off-by: Aditya Kothari <akothari@lyft.com> * ignore java Signed-off-by: Aditya Kothari <akothari@lyft.com> * fix syntax Signed-off-by: Aditya Kothari <akothari@lyft.com> * fix error Signed-off-by: Aditya Kothari <akothari@lyft.com> * fix java exception Signed-off-by: Aditya Kothari <akothari@lyft.com> * fix fail statement Signed-off-by: Aditya Kothari <akothari@lyft.com> * Pull message rules out Signed-off-by: Aditya Kothari <akothari@lyft.com> * fix tests Signed-off-by: Aditya Kothari <akothari@lyft.com> * undo style change Signed-off-by: Aditya Kothari <akothari@lyft.com> * removing messagerules Signed-off-by: Aditya Kothari <akothari@lyft.com> * use messagerules inside rulecontext Signed-off-by: Aditya Kothari <akothari@lyft.com> * remove generated files Signed-off-by: Aditya Kothari <akothari@lyft.com> * prevent use of non-scalar wkts with message rules Signed-off-by: Aditya Kothari <akothari@lyft.com> * Unnecessary change Signed-off-by: Aditya Kothari <akothari@lyft.com> * add float rules Signed-off-by: Aditya Kothari <akothari@lyft.com> * C++ support Signed-off-by: Aditya Kothari <akothari@lyft.com> * java support Signed-off-by: Aditya Kothari <akothari@lyft.com> * Update docs Signed-off-by: Aditya Kothari <akothari@lyft.com> * Changes updated Signed-off-by: Aditya Kothari <akothari@lyft.com> * fixing javabuild Signed-off-by: Aditya Kothari <akothari@lyft.com> * Fix file permission Signed-off-by: Aditya Kothari <akothari@lyft.com>

Commit:a09ef37
Author:Ryan Michela
Committer:GitHub

Switch extension numbers to registered value (#227) Signed-off-by: Ryan Michela <rmichela@salesforce.com>

Commit:30b4f8c
Author:Joel Griffith
Committer:Chris Roche

Add UUID as a well-known string type (#217) Signed-off-by: Joel Griffith <jgriffith@niche.com>

Commit:9b492f1
Author:Eric
Committer:Chris Roche

add new validation type address (#207) * add new validation type address fixes #169 this commit adds in a new validation type for strings - "address". this type can be either a valid IP Address, or valid Hostname. The goal is to validate that it looks like something that can be connected too. Signed-off-by: Eric <ecoan@rust-lang.life> * proper exception message for java Signed-off-by: Eric <ecoan@rust-lang.life> * nit: remove unnecessary parens Signed-off-by: Eric <ecoan@rust-lang.life> * Remove nested exceptions from java validation Signed-off-by: Eric <ecoan@rust-lang.life>

Commit:c15f2c2
Author:Ryan Michela
Committer:GitHub

Correctly handle proto files and messages with consecutive upper-case characters (#210) Signed-off-by: Ryan Michela <rmichela@salesforce.com>

Commit:ff9227e
Author:Ryan Michela
Committer:GitHub

Embedded messages in protos with java_multiple_files=true throws NullPointerException (#211) * Replicate nullPointerException with embedded multi-file proto Signed-off-by: Ryan Michela <rmichela@salesforce.com> * Fix embedded message validation when java_multiple_files = true Signed-off-by: Ryan Michela <rmichela@salesforce.com>

Commit:1c0e3fb
Author:Alex Konradi
Committer:Chris Roche

Add test case for repeated min with item length (#206) * Add test case for repeated min with item length Add a variation on the case in #203 to both demonstrate the syntax and to make sure future changes don't cause this functionality to break. Signed-off-by: Alex Konradi <akonradi@google.com> * Remove accidentally added unrelated file Signed-off-by: Alex Konradi <akonradi@google.com>

Commit:54b08a6
Author:Ryan Michela
Committer:Chris Roche

ReflectiveValidatorIndex fails when option java_multiple_files=true (#186) * Replicate java_multiple_files bug in ReflectiveValidatorIndex Signed-off-by: Ryan Michela <rmichela@salesforce.com> * Generate exploded java validator classes when java_multiple_files=true Signed-off-by: Ryan Michela <rmichela@salesforce.com> * Fix bazel build Signed-off-by: Ryan Michela <rmichela@salesforce.com>

Commit:d71e418
Author:wdullaer
Committer:Chris Roche

Updated go dependencies (#181) * Pulls in fix for packagename escaping from protoc-gen-star Fixes #180 * Updated Dockerfile Dockerfile now also installs dep and buildozer so that the `make vendor` and `make gazelle` targets run inside the container Signed-off-by: Wouter Dullaert <wouter.dullaert@gmail.com>

Commit:fefdc4b
Author:Ryan Michela
Committer:Chris Roche

Feature/release prep (#170) * Java 11 compilation compatibility Signed-off-by: Ryan Michela <rmichela@salesforce.com> * Use mavenized generator artifacts from protobuf-maven-plugin Signed-off-by: Ryan Michela <rmichela@salesforce.com> * com.lyft → io.envoyproxy Signed-off-by: Ryan Michela <rmichela@salesforce.com> * Fix readme <pluginArtifact> Signed-off-by: Ryan Michela <rmichela@salesforce.com>

Commit:5eea078
Author:Chris Roche
Committer:GitHub

Migration: Rename imports throughout (#161) * s#github.com/lyft/protoc-gen-validate#github.com/envoyproxy/protoc-gen-validate#g Signed-off-by: Chris Roche <github@rodaine.com> * vendor bazel files Signed-off-by: Chris Roche <github@rodaine.com> * checkpoint Signed-off-by: Chris Roche <github@rodaine.com>

Commit:4349a35
Author:Chris Roche
Committer:GitHub

Properly handle repeated enums (#140)

Commit:bd502d0
Author:Ryan Michela
Committer:Chris Roche

Add java_package option to validate.proto (#120)

Commit:a346734
Author:Ryan Michela
Committer:Chris Roche

[WIP] Implement Java validator generators (#108) * Fix golint import * Create java project * Create java modules * Add validation protos * Generate empty .java files * Generate empty validation classes * Update vendored libs * Fix build * Generate top-level message functions * Add type-level template references * Implement boolean validation * Fix build * Add type-level template references * Implement numeric validation * string validation * string validation * Fix In/NotIn * Use google RE2J regex lib per spec * bytes validation * bytes validation * update build file * Enum Validation * duration validation * duration validation * required support * fix build file * fix build again * fix pattern escape * timestamp validation * fix timestamp build * fix timestamp build again * Unit tests and formatting * Finish implementing bytes validation * Finish implementing duration validation * Introduce Validator base class * Finish implementing enum values * map validation * any validation * oneof validation * remove unnecessary braces for in and notin * Basic message validation * Code formatting * Restore braces around in/notIn * Refactor required validations * Fix deprecation warnings * Implement index file generation * Implement recursive message validation * Implement message-global validation * Implement oneof required * Added Wrapper Validation Support * Combine accessor and wrappedAccessor functions * Compile Envoy protos as a test case * Fix oneof enum case * Uppercase field name char after number * Respect java class name options * Fix java_multiple_files * Don't generate files for protos that don't use PGV * pvg -> pgv * Fix file name off by one directory * Client and server interceptors * Don't double half-close grpc server calls * Demo program * Fix demo programs * Remove envoy protos * Move constant values to constant fields * Remove gRPC sample * Comment on why file path could be nil * Fix bytes const generator * Refactor java constant validation * Refactor java comparative validation * Refactor java collective validation * Implement repeated validation * Implement test harness * Partially implement range validation * Partially implement range validation * Implemented range validation * Fix numeric constant validation * Empty child messages are valid unless required * Always validate repeated child messages * Fix string format validators * Partially implement KVP validation * Partially implement KVP validation * Add Java to makefile and run all tests * Add Maven to dockerfile * Work around Open-jdk bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911925 * Ensure UTF-8 byte arrays for strings * Include bad values in validation exception messages * Register validators using static initialization Instead of auto-generating GeneratedValidatorIndex once for each package, which would cause name conflicts when using multiple PGV libraries, include it in the runtime PGV Java library. This allows validator classes to register at runtime when they are first loaded. Since Java does lazy loading, the GeneratedValidatorIndex class optimistically attempts to load a validator when it is needed. * Add java_proto_library targets * Add PGV java generation Bazel rules * Add Java build dependencies for Bazel * Add build rules and run Java harness * De-duplicate Bazel Java/C++ rule impls * Ignore more Java stuff * fix compilation in interceptor tests Signed-off-by: Rama Chavali <rama.rao@salesforce.com> * Fix find command in Java bazel build * Small Makefile tweak for Java * Add harness selection flags * Improve .gitignore * Improve reflection caching * Javadoc * Prep POM for maven releases

Commit:e143189
Author:Chris Roche
Committer:GitHub

enum: properly prefix validation function name (#112)

Commit:1e3afd7
Author:Chris Roche
Committer:GitHub

deps: update PG* (#111)

Commit:07c5fc6
Author:Chris Roche
Committer:GitHub

enums: properly handle enums imported from an external package/namespace (#110) * enums: properly handle enums imported from an external package/namespace * include import mapping to makefile protoc calls

Commit:2a7aa7d
Author:Chris Roche
Committer:GitHub

Upgrade to PG* 0.4.3 (#109) * Upgrade to PG* 0.4.3 * checkpoint * checkpoint

Commit:3bd820a
Author:Chris Roche
Committer:GitHub

Upgrade to PG* v0.4.2 (#103) * PG* Update (sans BAZEL updates) * make protoc-gen-validate buildable * revert BUILD changes for tests/harness * checkpoint * checkpoint * BUILD changes * checkpoint * checkpoint * checkpoint * checkpoint * checkpoint * checkpoint * sort template functions

Commit:e60e7f9
Author:Sam Smith
Committer:Chris Roche

Bump rules_go to 2383294 (#87) This is to pick up fixes that allow rules_go to work on Windows. There are several required steps to make this work: 1. Remove fork of go_proto_library.bzl and rework pgv_go_proto_library to use proto rules from rules_go 2. Because of 1, bump dependencies in Gopkg.toml to match those in rules_go a. github.com/golang/protobuf -> v1.1.0 b. github.com/lyft/protoc-gen-star -> v0.3.7 c. github.com/gogo/protobuf -> v1.0.0 3. Correct location in Makefile for generated validate.pb.go 4. Update protos in tests/kitchensink to explicitly set go_package option. Without this option, the generated *.pb.validate.go files had empty package names (the regular *.pb.go files were fine) 5. Rerun "gazelle fix" in the vendor directory to regenerate BUILD.bazel files. Signed-off-by: Sam Smith <sesmith177@gmail.com>

Commit:d260f5a
Author:Back Yu
Committer:Chris Roche

solve to #79. (#80) * solve to #79. * fix CI failed for #80 * fix reviewing for #80 * add test cases for #80 * fix debug code for #80 * fix format bug for #80 * templates: improve by #80 * readme.md: fix comment to #80. * templates: fix for equal min/max for #80 Signed-off-by: Back Yu <yhfszb@gmail.com> * tests: add cases to `equal min/max len` for #80 Signed-off-by: Back Yu <yhfszb@gmail.com> * templates: improve for #80 Signed-off-by: Back Yu <yhfszb@gmail.com> * fix readme for #79.

Commit:f9d2b11
Author:Jose Ulises Nino Rivera
Committer:GitHub

fix nested in rule for repeated string fields (#78) Nested in rules for repeated fields do not generate the necessary global mapping in the generated proto. This patch fixes the rule for string repeated fields and can be generalized for repeated fields of other types.

Commit:9f600c2
Author:htuch
Committer:GitHub

templates: fix Duration C++ code generation bug. (#73) Previously, if the duration field was missing, it would short circuit evaluation of following fields in the message the template was embedded in. This triggered the server config proto fuzz tests for Envoy. Signed-off-by: Harvey Tuch <htuch@google.com>

Commit:eacbe4c
Author:Chris Roche
Committer:GitHub

Add tests for escape sequences in regex patterns (#69)

Commit:cae3648
Author:Kuat
Committer:Chris Roche

gogo support (#66) * Initial prototype Signed-off-by: Kuat Yessenov <kuat@google.com> * add test Signed-off-by: Kuat Yessenov <kuat@google.com> * tests Signed-off-by: Kuat Yessenov <kuat@google.com> * remove test gogo files Signed-off-by: Kuat Yessenov <kuat@google.com> * edit proto fields Signed-off-by: Kuat Yessenov <kuat@google.com> * fixing tests Signed-off-by: Kuat Yessenov <kuat@google.com> * fixing tests Signed-off-by: Kuat Yessenov <kuat@google.com> * add gogo harness Signed-off-by: Kuat Yessenov <kuat@google.com> * add gogo harness Signed-off-by: Kuat Yessenov <kuat@google.com> * missing file Signed-off-by: Kuat Yessenov <kuat@google.com> * vendor gogo Signed-off-by: Kuat Yessenov <kuat@google.com> * bazelify Signed-off-by: Kuat Yessenov <kuat@google.com> * use local gogofast Signed-off-by: Kuat Yessenov <kuat@google.com> * separate templates Signed-off-by: Kuat Yessenov <kuat@google.com> * separate templates Signed-off-by: Kuat Yessenov <kuat@google.com> * respond to review Signed-off-by: Kuat Yessenov <kuat@google.com>

Commit:930a67c
Author:Kent Wang
Committer:Chris Roche

Fix pattern rule in repeated and map field (#58) * Fix pattern rule in repeated and map field Add pattern variable declaration when repeated.items, map.keys or map.values contains string rule with pattern. * Add test cases to executor

Commit:8e6aaf5
Author:htuch
Committer:GitHub

template/module: support for cross-package message validation in C++. (#40) * Fix some namespace issues, previously wasn't qualifying embedded message. * Switched from template (compile-time) to weak link (link-time) Check function definition. This allows us to resolve #39. * To support the above, switched away from inlining and header only generation for C++ to a split header/implementation structure. Fixes #39. Signed-off-by: Harvey Tuch <htuch@google.com>

Commit:906f18a
Author:Chris Roche
Committer:htuch

Validate message elements in repeated fields (#38) This patch addresses an issue (in both Go and C++) where messages embedded in a repeated field would not be validated unless the repeated field itself had validation rules applied. Additionally, the skip rule on messages embedded in repeated fields caused compilation errors due to unused variables for the elements. The current solution here still leaves the loop (which hopefully gets optimized out by the compiler); a later fix should ensure the loop is not emitted. Finally, some cleanup to some of the bazel rules to properly run the test harness. Later on, may convert the harness to utilize the Go test framework for better portability (and limiting which test cases are executed).

Commit:36e0c0b
Author:htuch
Committer:Chris Roche

template: some C++ fixups to support Envoy data-plane-api. (#36) * template: some C++ fixups to support Envoy data-plane-api. With these changes, Envoy data-plane-api protos now pass the C++ compile time checks: * Fix duration temporary variable scoping. * #pragma once the header files. * Fix code generation for repeated messages. Turns out we didn't have any test for this, so added to catch regression. Signed-off-by: Harvey Tuch <htuch@google.com> * Push prefix stripping closer to generating code. Signed-off-by: Harvey Tuch <htuch@google.com> * Stricter copts to match Envoy, unused params fixups. Signed-off-by: Harvey Tuch <htuch@google.com>

Commit:9367bd2
Author:htuch
Committer:Chris Roche

templates: C++ Duration support. (#35) * templates: C++ Duration support. This is a bit hackier than the equivalent Go supports, since we don't have ptypes.Duration to do nice things like equality and validity checking. Instead, we treat Duration as an integer representing nanoseconds and implement the validity constraints documented in https://github.com/google/protobuf/blob/master/src/google/protobuf/duration.proto. Signed-off-by: Harvey Tuch <htuch@google.com> * Add TODO for large test. Signed-off-by: Harvey Tuch <htuch@google.com>

Commit:500ccdb
Author:Chris Roche
Committer:GitHub

Checker: more robust WKT wrapper detection (#21)

Commit:605b154
Author:akonradi
Committer:Chris Roche

Start filling out the validation code in C++ (#17) * Keep go and cc templates separate Otherwise the last set of templates registered take proprity, so the Go templates override the C++ ones * Initial C++ validation code templates * Make imported pgs package name explicit * Test boolean C++ validation * Add C++ wrapper template to make the build work This will be removed in a later commit. * Prevent regression by allowing failing TestResults Instead of allowing any of the test cases from entire test handler to fail without failing the test, require that test cases allowed to fail be individually marked. This prevents errors from being masked while allowing unimplemented tests to pass. * Enable C++ validation for numeric types The code for this was already mostly implemented in the template, but now it is actually tested by the C++ harness. * Add comments about the C++ harness macro

Commit:391bdf3
Author:Chris Roche
Committer:GitHub

OneOf: properly avoid naming conflicts (#13)

Commit:9ac970c
Author:htuch
Committer:GitHub

bazel: minor fixups for Envoy data-plane-api Go build with validate.p… (#7) * Define go_package in validate.proto. * Bumped io_bazel_rules_go SHA to match data-plane-api. Signed-off-by: Harvey Tuch <htuch@google.com>

Commit:10e02a4
Author:Chris Roche
Committer:htuch

Complete Test Cases + Bug Fixes (#3)

Commit:9c510dd
Author:Chris Roche
Committer:GitHub

Cleanup Test Structure & Bazel Rules (#2)

Commit:fb75d75
Author:Chris Roche
Committer:GitHub

Test Harness (#1) * Test Harness * no harness binary * CI Make target * checkpoint * CR comments

Commit:04c7484
Author:Chris Roche

Initial Commit