Currently in my organization, we are using dry-validation a lot with dry-transaction for the usual CRUD operations in our app. One thing that i find a bit weird is that we had to write a wrapper for the dry-validation schemas that looked like this to wrap the result of the schema in a dry-monad result
result = schema.call(input) if result.success? Success(result.to_h) else Failure(result.errors) end
so upon digging a bit deeper, I found out that dry-validation schemas return
Dry::Validation::Result instead of
Dry::Monad::Result. So my questions would be…
- is there a better way to incorporate dry-validation with dry-transaction? (perhaps we’ve been using it wrong in our organization)
- are there plans to one day use dry-monad results as the result of dry-transaction schemas?