CORE-15421: add protovalidate as well-known type#29404
Conversation
Add buf/validate/validate.proto as a well-known type in schema registry so that schemas importing protovalidate validation rules can be registered without explicitly providing references. Changes: - Add protovalidate bazel dependency (version 1.0.0) - Add validate_proto_cc to schema_registry:core implementation_deps - Include buf/validate/validate.pb.h and add to known_types set - Add unit test coverage in test_protobuf_well_known - Add integration test in schema_registry_test.py Signed-off-by: Michael Boquard <michael@redpanda.com>
There was a problem hiding this comment.
Pull request overview
This PR adds native support for buf's protovalidate library to Redpanda's Schema Registry by treating it as a well-known type. This enables schemas that import protovalidate validation rules to be registered without explicitly providing references.
Changes:
- Adds protovalidate as a Bazel dependency and includes it in the schema registry's known types
- Updates unit and integration tests to verify protovalidate types can be used without explicit references
- Adds comprehensive coverage of protovalidate message types in the well-known types test
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| MODULE.bazel | Adds protovalidate v1.0.0 as a Bazel dependency |
| src/v/pandaproxy/schema_registry/BUILD | Links protovalidate's validate_proto_cc library to schema_registry core |
| src/v/pandaproxy/schema_registry/protobuf.cc | Includes validate.pb.h header and registers protovalidate file descriptor as a known type |
| src/v/pandaproxy/schema_registry/test/compatibility_protobuf.cc | Extends well-known types test to include 9 protovalidate message types |
| tests/rptest/tests/schema_registry_test.py | Adds integration test verifying protovalidate imports work without explicit references |
|
@rockwotj - added you to just cross check me on the bazel stuff I did... it appears to work so I don't think I did anything wrong, but wouldn't mind you just double checking the bazel stuff.... graci! |
Retry command for Build#79643please wait until all jobs are finished before running the slash command |
| message TestValidate { | ||
| buf.validate.FieldRules field_rules = 1; | ||
| buf.validate.StringRules string_rules = 2; | ||
| buf.validate.Int32Rules int32_rules = 3; | ||
| buf.validate.MessageRules message_rules = 4; | ||
| buf.validate.TimestampRules timestamp_rules = 5; | ||
| }""" |
There was a problem hiding this comment.
It's a more realistic test if you use them as annotations like they are supposed to be :)
|
|
||
| bazel_dep(name = "rules_shell", version = "0.4.1", dev_dependency = True) | ||
|
|
||
| bazel_dep(name = "protovalidate", version = "1.0.0") |
There was a problem hiding this comment.
This is fine, but it's a fairly heavy dependency to only need the protos :)
I think it's fine tho don't bother changing it
CI test resultstest results on build#79643test results on build#79654
|
|
/ci-repeat 1 |
|
/backport v25.3.x |
|
/backport v25.2.x |
|
/backport v25.1.x |
|
Failed to create a backport PR to v25.1.x branch. I tried: |
|
Failed to create a backport PR to v25.2.x branch. I tried: |
Add buf/validate/validate.proto as a well-known type in schema registry so that schemas importing protovalidate validation rules can be registered without explicitly providing references.
Changes:
Backports Required
Release Notes
Improvements