specta-rs / specta

Easily export your Rust types to other languages
MIT License
276 stars 38 forks source link

Typed input validation #136

Open oscartbeaumont opened 1 year ago

oscartbeaumont commented 1 year ago

Investigate the idea of a built-in input validation library that has typesafe errors with the frontend.

natestraub commented 11 months ago

I'm actually trying to figure out how to do JSDoc comments on individual fields (rather than the full struct ) for this reason as a short-term solution. Using ts-to-zod (https://www.npmjs.com/package/ts-to-zod), one could take the output from this schema with the JSDoc Tag Validators and generate a zod schema with the right frontend validation logic.