These are chat archives for dry-rb/chat

31st
Jan 2016
Tom de Bruijn
@tombruijn
Jan 31 2016 12:40
Hi everyone, using dry-validation I'm trying to map the messages back to the object they came from. What's the best approach here as the result array can be a bit more difficult to search within a nested validation. Is there an easy way to search the result?
{:user=>
  [[{:name=>[["name is missing"], {:name=>"foo", :email=>"foo@bar"}]}, {:email=>[["email is missing"], {:name=>"foo", :email=>"foo@bar"}]}],
   {:name=>"foo", :email=>"foo@bar"}]}

messages[:user][0][0][:name][0]

# To something more accessible like this?
messages[:user][:name]
Piotr Solnica
@solnic
Jan 31 2016 12:51
@tombruijn this will be improved in 0.7.0
I’ll probably provide some decorator object for raw messages hash, it’s ok for simple structs but with nested ones it gets hard, as you pointed out
esp with nested arrays within hashes
Tom de Bruijn
@tombruijn
Jan 31 2016 13:02
@solnic that's great news! I understand it's still under development
I'll make my own little wrapper around it now I think, and wait for what 0.7 will bring
Piotr Solnica
@solnic
Jan 31 2016 13:03
@tombruijn I’ve been focusing mostly on the core logic, error messages received very little focus so far
@tombruijn sounds good :) I should release 0.7.0 later next week
Tom de Bruijn
@tombruijn
Jan 31 2016 13:08
Oh wow that's really soon :smile:
but yeah, focus on the core first :+1:
Piotr Solnica
@solnic
Jan 31 2016 13:27
@tombruijn I’m already working on error compilation, haven’t pushed it yet but got various improvements done already locally