These are chat archives for dry-rb/chat

19th
Oct 2018
Igor Alexandrov
@igor-alexandrov
Oct 19 2018 07:41
@ethnt I guess, you should look at Reform, it has an ability to map keys to model.
Vasily Kolesnikov
@v-kolesnikov
Oct 19 2018 08:29

Is this something that's possible with dry-validation?

Probably not. At least dry-v should be used for other. Look at https://github.com/solnic/transproc, I use it for the same tasks as your.

Tim Riley
@timriley
Oct 19 2018 08:47
@ethnt Yeah, I would do similar to @v-kolesnikov’s suggestion: put dry-validation as close as possible to the edge of the app, i.e. it would validate the input from the external API. After that point, you know you’re dealing with good data, so you could use transproc to transform it.
Ethan Turkeltaub
@ethnt
Oct 19 2018 17:30
Thanks for the answers everyone. What we're trying to do is use dry-validation's schema to validate the inputs from an internal system, call out to one of two external APIs, massage the responses from them, and then map those responses to an internal model. The problem we're running into is that we'd like to share the schema between dry-validation and the internal model (currently using dry-struct) but we can't really
The internal model isn't database backed. We considered ActiveType but it didn't really jive with what we were trying to do
Ethan Turkeltaub
@ethnt
Oct 19 2018 17:38
Transproc and Reform look very promising, thank you though! Maybe a combination is what we're looking for