- 04 Dec, 2017 1 commit
-
-
htuch authored
* 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>
-
- 02 Dec, 2017 2 commits
-
-
akonradi authored
and add a test (that really only checks compilation) to ensure that multiple compilation units that include the validation code can be linked together.
-
Chris Roche authored
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).
-
- 01 Dec, 2017 2 commits
-
-
htuch authored
* 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>
-
htuch authored
* 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>
-
- 30 Nov, 2017 4 commits
-
-
akonradi authored
-
akonradi authored
* Implement unique constraint C++ generation * Fix inType for C++ templates * Test C++ repeated field validation * Use unordered set for C++ repeated unique checks
-
akonradi authored
* Start working on C++ string constraint support * Mark other C++ string validations as unimplemented * Enable oneof validation tests in C++ Now that most of the string validation code template is written, the oneof tests produce code that compiles and passes all the tests.
-
htuch authored
Need to use workspace qualified names to support pgv_proto_library use across repos. Signed-off-by:
Harvey Tuch <htuch@google.com>
-
- 29 Nov, 2017 4 commits
-
-
akonradi authored
* Make C++ error messages more like the Go ones * Bugfix: field named 'const' has accessor 'const_' A field named "const" is accessed as "m.const_()", so generate code appropriately. * Predeclare Validate() functions to support nesting * Use correct message name in C++ output * Add C++ validation library * Use fully-qualified C++ message class names * Implement nested validation in C++ This is ugly, because we don't necessarily generate a validation function for every proto message type (ex: the well-known google::protobuf::Any type). Use some template metaprogramming to work around this, where each validation function is invoked if it exists, and a default fallback version is provided as well.
-
htuch authored
This was needed to support building the protos in Envoy's data-plane-api. It would be ideal to switch to Bazel aspects for pgv_cc_proto_library and native proto_library, but there are some limitations I hit while doing so, will defer that for now. Signed-off-by:
Harvey Tuch <htuch@google.com>
-
akonradi authored
* Translate most bytes validation code to C++ Implement everything except regular expression and IP address validation. * Mark other C++ byte validations as unimplemented
-
akonradi authored
-
- 28 Nov, 2017 2 commits
- 27 Nov, 2017 3 commits
-
-
akonradi authored
-
Chris Roche authored
-
akonradi authored
* 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
-
- 20 Nov, 2017 1 commit
-
-
akonradi authored
* Fix default protoc in cc_proto_library The old default used a relative reference. Since this is a fork from the original protobuf repo location, use an absolute reference instead. * bazel: test executor depends on harness as data The harness is an executable, not a library that is imported, so treat it as a generated data item. * Build C++ test protos * Support lax test harnesses This will be used to prevent the tests from all failing once the C++ validation harness is introduced. * Add C++ test harness * Bring naming in line with Google/Envoy style * Allocate message for validation inside lambda Instead of allocating the memory separately and then using it in the lambda, allocate the destination proto message inside the lambda because it's cleaner and doesn't mix scopes.
-
- 16 Nov, 2017 2 commits
-
-
Chris Roche authored
-
Chris Roche authored
-
- 10 Nov, 2017 1 commit
-
-
Kuat authored
Fixes #9. Signed-off-by:
Kuat Yessenov <kuat@google.com>
-
- 07 Nov, 2017 3 commits
-
-
htuch authored
Needed to suppor Python protodoc tool in data-plane-api. Signed-off-by:
Harvey Tuch <htuch@google.com>
-
akonradi authored
The bazel-built test executable was executing but not succeeding because the validation code was not getting linked in at compile-time and the test used lazy duck-typing to validate. This patch 1. makes the test fail loudly if an input doesn't implement the correct interface 2. updates the bazel rule to link in the validation code 3. fixes the test code so it imports the validation code 4. modifies the CI script to also run the tests via bazel
-
htuch authored
* 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>
-
- 05 Nov, 2017 2 commits
-
-
htuch authored
This allows other Bazel consuming protos to be able to import validate.proto in a language neutral way, needed by data-plane-api. Also s/protobuf_bzl/com_google_protobuf/ to conform to standard repository naming across Bazel projects. Signed-off-by:
Harvey Tuch <htuch@google.com>
-
akonradi authored
Fix the bazel build files so that bazel build :protoc-gen-validate builds a binary and bazel test //tests/... runs all the included test cases (which currently fail).
-
- 29 Oct, 2017 1 commit
-
-
Chris Roche authored
-
- 26 Oct, 2017 1 commit
-
-
Chris Roche authored
-
- 19 Oct, 2017 1 commit
-
-
Chris Roche authored
* Test Harness * no harness binary * CI Make target * checkpoint * CR comments
-
- 03 Oct, 2017 1 commit
-
-
Chris Roche authored
-