Challenges of Using Schema Primitives for DB Schema Modeling and Domain Mapping
Hi. I'm trying to use Schema to model the usual DB schemas, where you will need an insert one, a select one and (sometimes) an update one and also a mapping between some of those and my own domain schemas. I tried defining separated schemas, extending schemas, doing transformations, and it is all being very inconvenient. ´ The amount of code that I need to write using schema primitives is quite high, and honestly it seems that at certain point I will be writing less code if I do it manually with some small casts. Is this maybe something Schema is not good for? Even if I don't use Schema primitives I want to leverage as much as possible the types on "shapes" for my "translation functions", but this becomes quite hard a lot of times when the schemas to translato to/from have more restrictive types (for example string VS "A" | "B"). I think I will need some kind of parser that gives me hints on the structure but not on the type itself, and I'm not sure if that is even doable without casts. I know I already triggered been some conversations about this here (schemaUnderstanding the Purpose of `Schema.decodeEither` in Type-Safe Parsing) but I wanted to ask it again with a more specific topic and some example code I tried (code in the thread, because this is already long)