Implementing Business Logic Validation in `Schema.TaggedClass` with Custom Validation Function
What would be a good way to do some simple business logic validation when creating a class using
Schema.TaggedclassSchema.Taggedclassexport class ProductOptionEntity extends Schema.TaggedClass<ProductOptionEntity>(
"ProductOptionEntity",
)(
"ProductOptionEntity",
Schema.Struct({
...Struct.omit(ProductOption.fields, "id", "values"),
id: Schema.optionalWith(ProductOptionId, {
default: () => ProductOptionId.make(generateId()),
}),
values: Schema.Array(Schema.string),
// ^^^ For example, how can I make sure here these strings are not ""
}),
) {}