What am I doing here? #13
TonyGravagno
started this conversation in
General
Replies: 1 comment
-
The issues with MySQL-to-Zod were addressed quickly. I'm impressed with @araera111. There were a couple issues with dependency node-sql-parser, but they were quickly addressed in that project and MySQL-to-Zod was updated accordingly. With little response from @erwinstone, I'm checking with Ou Fumio about contributing to MySQL-to-Zod. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As noted in #5 there are many ways to type data in MySQL and many ways to validate similar types in Zod. This utility will take a dev from no schema at all to some percentage of what they need. It should be well understood that no general-purpose FOSS utility is going to zap out a perfect schema for every possible database schema. Anyone using this will need to look at the code that's generated, tweek options a few times, and settle on what feels like a good start, where they will break away from the generator and move forward with changes by-hand.
After a great kickoff from @erwinstone and the upstream core, I'm doing most enhancements for myself, though in the FOSS spirit of pay-forward and pay-back. I'm working on a new app starting with 70 tables - which I generated from a XMind mindmap. From the generated Zod schema, have other code from which I'm generating (so far) 275 React modules around the schema. I'm trying to get a better head-start with better schema for common MySQL types, and happy to share it with others.
How far do I want to go with this? After the initial push for my project I'll probably take a break for a while. I have no idea what Erwin wants to do with his project and no idea if anyone else has interest in this either.
There is another MySQL-to-Zod project that might ultimately seem like a better base to build upon, and the author @araera111 seems very responsive. After I close some of the tickets in this MySQL-Zod fork I might look more closely at MySQL-to-Zod, and maybe even cross-PR some common functionality.
For anyone looking at this stuff, the fundamental difference between the projects is:
case "BIT": return "z.boolean()";
. That code also returns mostly Zod primitives, and it does not fully define most of the same types.I think MySQL-to-Zod is overall a better platform to move forward. It's more modular and has more built-into it. That's not to disparage MySQL-Zod, which is a fine start and does what it needs to do. And I thank Erwin for processing my PRs. Unfortunately when I started to look at these projects, I stumbled on init details with MySQL-to-Zod, but MySQL-Zod ran perfectly with almost no effort. So I started with the latter, and now with some semi-portable features built-up, I look forward to retrying the former.
That's all for now.
Beta Was this translation helpful? Give feedback.
All reactions