[question] message validation
See original GitHub issueHey team Buf, we are loving what you are building, thank you sooo much!!!
It was a breeze switching from @improbable-eng/grpc-web
to connect-web
.
We are looking to transitioning to connect-go
in the future (still using @improbable-eng
’s grpcweb
).
The question here is regarding message validation.
We are wondering if you are at all considering implementing message validation
as a part of the connect
ecosystem?
(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.)
Issue Analytics
- State:
- Created a year ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Response Requirements & Validation - Qualtrics
Response requirements & validation are used to alert respondents about questions they may have missed, or they can be used to solicit a...
Read more >How to Add Validation to a Text Response Question
Within your form, click on the question you wish to add Validation to; Click on +Options; Select the drop-down beside Validation; Select a ......
Read more >Custom Validation Messages | QuestionPro Help Document
Create your own custom validation messages for each question in the survey to let respondents know why they failed or what they need...
Read more >What is validation? - Online surveys
To “show validation” means to display a message to respondents stating the restrictions that you have set for their answers. When “Show validation”...
Read more >Validating Open-Ended Text Fields - SurveyMonkey Help
You can validate some open-ended question types to require respondents to enter their answer in a specific format.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 giveprotoplugin
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) andconnect-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 (
MyMessageSchema.parse(message)
).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 …
/cc @timostamm