Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[question] message validation

See original GitHub issue

Hey 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:open
  • Created a year ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

fubhycommented, Sep 19, 2022

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.

fubhycommented, Nov 2, 2022

@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 (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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found