Issues with Default Values in Prisma Config Schema Using Effect-Smol Library
Hello, I stumbled into some problems while trying to expand the
For context, I want to parse one of the two alternatives in
and have
I can't find a way to reliable set default constructors in
It seems that piping
Here's a self-contained script with what I tried, with TODO comments: https://gist.github.com/jkomyno/30862bd7d0630d2a861538fcb843dc92
Any help is appreciated
@prisma/config effect/Schema definitions with union types with default values.For context, I want to parse one of the two alternatives in
SchemaEngineConfigand have
effect/Schema parse the default { engine: 'classic', datasource: undefined } value when the user doesn't specify any SchemaEngineConfig.I can't find a way to reliable set default constructors in
Schema.Union values that are merged into a Schema.Struct. I heard that effect-smol makes things simpler in that regard, so I decided to try the new APIs out (https://pkg.pr.new/Effect-TS/effect-smol/effect@73e2109).It seems that piping
Schema.withConstructorDefault to a Struct breaks Struct.mapFields, while piping it to a TaggedUnion breaks Union.mapMembers. Chances are I'm holding something wrong. I can only get the code to compile and run when no Schema.withConstructorDefault is used, but that implies I'm not getting the default value I wanted.Here's a self-contained script with what I tried, with TODO comments: https://gist.github.com/jkomyno/30862bd7d0630d2a861538fcb843dc92
Any help is appreciated
