Replies: 2 comments 1 reply
-
|
There is no information in the provided sources about accessing Zod functions via FFI or using Zod natively in runtimes or languages other than JavaScript/TypeScript (such as Go or C#) (1), (2), (3), (4), (5), (6), (7). Zod is documented as a TypeScript-first validation library for defining and validating schemas in JavaScript and TypeScript environments (3), (5). No cross-language FFI or official bindings for other languages are mentioned. 📚 Sources:
Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
What you are looking for is a language agnostic schema spec. I would recommend looking into JSON Schema for this purpose. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've primarily used Zod on front-end projects with React to validate fields and show error messages on the client. I have also used Zod for schema validations on small node based applications. However, larger server applications that I have worked with have been written in other languages like Go or C# given that these languages have more performant runtimes compared to Node/Bun.
This might be the wrong way to look at the problem but if we could access Zod functions using an FFI, or similar interface in all major runtimes/languages, this would mean that I could write a front-end that uses the same validations as the ones I use on a Node server, Go server, etc.
This mostly arrives from having the same validation logic/semantics across libraries and projects. This would also allow publishing an organization-wide method of validating something like a UUID or an email string, regardless of what a project is written in.
I am eager to hear how other people think about this and if they have encountered something similar.
Beta Was this translation helpful? Give feedback.
All reactions