1. 04 Dec, 2017 1 commit
  2. 02 Dec, 2017 2 commits
    • akonradi's avatar
      Declare C++ validation functions as static inline (#37) · b3cb659c
      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.
      b3cb659c
    • Chris Roche's avatar
      Validate message elements in repeated fields (#38) · 906f18a2
      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).
      906f18a2
  3. 01 Dec, 2017 2 commits
  4. 30 Nov, 2017 4 commits
  5. 29 Nov, 2017 4 commits
    • akonradi's avatar
      Validate "required" fields in C++ (#25) · 7c5d256e
      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.
      7c5d256e
    • htuch's avatar
      bazel: fix bug in transitive deps, support non-PGV cc_proto_library deps. (#28) · d75a15c1
      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: default avatarHarvey Tuch <htuch@google.com>
      d75a15c1
    • akonradi's avatar
      Translate most of the byte array validation code to C++ (#27) · faac9b3b
      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
      faac9b3b
    • akonradi's avatar
      Implement C++ validation for Any WKT. (#23) · c3ef2666
      akonradi authored
      c3ef2666
  6. 28 Nov, 2017 2 commits
  7. 27 Nov, 2017 3 commits
    • akonradi's avatar
      Implement C++ validation for enums (#20) · 15e079dc
      akonradi authored
      15e079dc
    • Chris Roche's avatar
      500ccdbb
    • akonradi's avatar
      Start filling out the validation code in C++ (#17) · 605b1545
      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
      605b1545
  8. 20 Nov, 2017 1 commit
    • akonradi's avatar
      Add C++ validation harness (#12) · b2a406d6
      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.
      b2a406d6
  9. 16 Nov, 2017 2 commits
  10. 10 Nov, 2017 1 commit
  11. 07 Nov, 2017 3 commits
  12. 05 Nov, 2017 2 commits
    • htuch's avatar
      bazel: export //validate proto_library target. (#5) · df5a2cc0
      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: default avatarHarvey Tuch <htuch@google.com>
      df5a2cc0
    • akonradi's avatar
      Fix bazel build (#4) · 0770f6b4
      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).
      0770f6b4
  13. 29 Oct, 2017 1 commit
  14. 26 Oct, 2017 1 commit
  15. 19 Oct, 2017 1 commit
    • Chris Roche's avatar
      Test Harness (#1) · fb75d756
      Chris Roche authored
      * Test Harness
      
      * no harness binary
      
      * CI Make target
      
      * checkpoint
      
      * CR comments
      fb75d756
  16. 03 Oct, 2017 1 commit