Creating Optional Fields in Effect-TS Schemas
Hi all! Inspired by Drizzle-Zod’s createInsertSchema and createUpdateSchema (where update schemas make fields optional for partial updates), I’d like to create a similar schema variation in Effect-TS with specific fields made optional.
In Zod, I can use refine for custom validation or partial to make fields optional, like this:
With Effect-TS, I have a class-based schema:
How can I create a version of this schema where id and name are optional, similar to an update schema? Is there a recommended way in Effect-TS to handle this, like Zod’s partial for specific fields?
With helper function
Thanks!
In Zod, I can use refine for custom validation or partial to make fields optional, like this:
With Effect-TS, I have a class-based schema:
How can I create a version of this schema where id and name are optional, similar to an update schema? Is there a recommended way in Effect-TS to handle this, like Zod’s partial for specific fields?
With helper function
Thanks!
