[question] message validationSee original GitHub issue
Hey team Buf, we are loving what you are building, thank you sooo much!!!
It was a breeze switching from
We are looking to transitioning to
connect-go in the future (still using
The question here is regarding message validation.
We are wondering if you are at all considering implementing message
validation as a part of the
(Just for the background, we are early in the development process, and are currently evaluating
envoyproxy/protoc-gen-validate for the backend and looking into colinhacks/zod with fabien0102/ts-to-zod for our frontend.)
- Created a year ago
- Comments:10 (6 by maintainers)
Top GitHub Comments
I came here looking for the same thing (typescript-first runtime message validation with
zod or similar).
I’ll have a bit of time by the end of this week and meant to play around with connect-web and protobuf-es (currently, we are using protobuf-ts and have a bespoke
zod based validation solution in place there). I’ll give
protoplugin a go then and see how far I can get. Will share any relevant progress here in case that’s useful for others.
FYI: I’m thinking of generating the code with PGV in a way that further refines the generated types (if possible, haven’t looked into it yet) according to the validation schema.
@johynpapin I pushed a first “work in progress” to that repository. Things are likely going to change quite a bit as I continue to experiment so be aware of that if you want to play around with it already.
I also haven’t implemented any runtime bindings yet. Not sure how I want to integrate it with
connect-web (client side validation) and
connect-node (server side validation) yet (interceptors?).
I might add another generator that uses grpc service definitions to generate a schema registry and generic validation function (that can validate any message).
For now you have to do that manually (
I am not particularly fond of the string based code generation and how I used it here … I think I would rather like to print some kind of abstract, composed AST. Particularly with something like the
zod API that is designed for chaining and composing function calls that would probably make the generator code quite a bit more digestable.
Anyways, it’s a start …