These are chat archives for dry-rb/chat

2nd
Mar 2017
Pablo Herrero
@pabloh
Mar 02 2017 23:20
How can you share definitions among schemas on dry-validations?
like for instance you have bunch of fields that you need to use very often is there a way to include them in other schemas without repeating your self?
(I mean at the top level, not inside another field)
Philip Arndt
@parndt
Mar 02 2017 23:23
I believe you can use something like predicates(ModuleWithMorePredicates) but I don't know if this solves your case
Pablo Herrero
@pabloh
Mar 02 2017 23:25
what would be inside ModuleWithMorePredicates?
"Defining Base Schema Class"
Pablo Herrero
@pabloh
Mar 02 2017 23:27
but i may have to include multiple of these...
Philip Arndt
@parndt
Mar 02 2017 23:27
..multiple inheritance?
Pablo Herrero
@pabloh
Mar 02 2017 23:27
no, more like including modules
is it possible to have something like:
module MyPredicates
  include Dry::Logic::Predicates

  required(:first_name).filled(:str?)
  required(:last_name).filled(:str?)
end
Philip Arndt
@parndt
Mar 02 2017 23:29
I suppose so, because it would just rely on Ruby's module and include functionality
but I haven't done it
Pablo Herrero
@pabloh
Mar 02 2017 23:29
mmmm, lemme try then...
Don Morrison
@elskwid
Mar 02 2017 23:35
Hey @parndt, while you’re here, let me say thanks for putting your Harvest API thing on GitHub. (ticktock). It helped me get our integration going. :)
I know it’s old, but having some code floating around to look at was nice.
Philip Arndt
@parndt
Mar 02 2017 23:36
ha neat!
That was fun to work on.
Don Morrison
@elskwid
Mar 02 2017 23:36
We needed to take invoices from Harvest, allocate the items to the people that did the work for the client, send them to Xero, then break the invoices apart in Xero. FUN!!
Your fun lives on!!
Pablo Herrero
@pabloh
Mar 02 2017 23:58
@parndt , didn't work... :/