flash-gordon on release-1.5
flash-gordon on master
Fix typo The text mentions `.d… Merge pull request #91 from Spo… (compare)
rule(location_provided: [:address, :latitude, :longitude]) do |address, latitude, longitude| (address.filled? & latitude.filled? & longitude.filled?) | (address.none? & latitude.none? & longitude.none?) end
each attribute name repeated 4 times. Seems not readable.
I could extract internal code to some helper function like
all_or_none(address, latitude, longitude)
but this will only reduce 1 mention of each name
Is it possible to use something like this?
rule(:location_provided) do |s| #s for schema all_or_none(s.address, s.latitude, s.longitude) end
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.
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