Add a Dart runtime for Protovalidate#509
Closed
SpencerC wants to merge 1 commit into
Closed
Conversation
Adds a first Dart implementation of Protovalidate under `dart/`. The runtime is reflective and descriptor-driven: rules and structure are read from a FileDescriptorSet (with the buf.validate extensions registered) and field values are read from generated messages via reflection. The same core powers the conformance executor. It implements the standard, CEL-free subset of Protovalidate — scalars, string (incl. email/uri/uuid), bytes, enum, repeated, and map rules, plus required/ignore and nested-message recursion. Custom CEL, well-known-type rules, extra string/bytes formats, message-level rules, and some Protobuf Editions cases are out of scope and recorded in dart/conformance/expected_failures.yaml. Conformance: passes all 2094 in-subset cases with 0 unexpected failures (778 out-of-subset cases marked as expected failures). - dart/: the `protovalidate` package, conformance executor, and unit tests - Makefile: test-dart, conformance-dart, generate-dart Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
SpencerC
force-pushed
the
feature/dart-protovalidate-runtime
branch
from
July 21, 2026 00:58
1237e4c to
e123fbe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a first Dart implementation of Protovalidate (see #148).
Approach
Reflective, descriptor-driven runtime that mirrors the Go/Python/ES design: rules and structure are read from a
FileDescriptorSet(with thebuf.validateextensions registered), and field values are read from generated messages via reflection. The same core powers both theValidatorAPI and the conformance executor. Because Dart has nodynamicpb, the executor unpacks eachAnyusing a generated registry of the conformance case types.Scope
Implements the standard, CEL-free subset of Protovalidate:
const/lt/lte/gt/gte/in/not_in/finite, including combined ranges (gt_lt,gte_lte_exclusive, …)string(includingemail/uri/uuid),bytes,bool,enumrepeatedandmap, includingitems/keys/valuesrequired/ignoreand nested-message recursionOut of scope for now (full parity would require a Dart CEL evaluator): custom / predefined / message-level CEL rules, well-known-type rules, additional string/bytes formats (hostname, ip*, address, uri_ref, tuuid, ulid, host_and_port, …), and some Protobuf Editions cases (a few of which
protoc-gen-dartdoes not yet generate). These are enumerated indart/conformance/expected_failures.yaml.Conformance
Passes every in-subset case with no unexpected failures:
(The 778 "skipped" are the out-of-subset cases listed in
expected_failures.yaml.)What's included
dart/— theprotovalidatepackage, conformance executor, unit tests, and READMEMakefile—test-dart,conformance-dart,generate-dartNotes for maintainers
dart/for now so it can reuse the conformance harness; happy to extract to aprotovalidate-dartrepo if that's preferred.dartjob runningmake test-dart+make conformance-dartcan be added on request.🤖 Generated with Claude Code