These are chat archives for dry-rb/chat

27th
Jun 2016
Daniel Sandbecker
@daniels
Jun 27 2016 09:19
Can I specify that a key should contain either an empty hash OR a hash that matches a schema? (I'm currently using 0.7-syntax, but if anyone has a solution that works on master that would probably help as well!)
Piotr Solnica
@solnic
Jun 27 2016 09:44
@heeton there are parts of dry-v which are less mature, so ie custom messages never received enough love so there are some rough edges. I’d appreciate if you could report an issue and simply describe what you tried to do and how it didn’t work, this will be a good starting point for me. I’m wrapping up 0.8.0 so it’s a good moment to get last-moment fixes in :)
Alex Heeton
@heeton
Jun 27 2016 10:02
@solnic Cool, will do.
Alex Heeton
@heeton
Jun 27 2016 14:57
@solnic I want to define a custom validation/predicate. My request submits "author_id", I want to verify that 'Author.find(1)' exists. It looks like custom predicates only get given the value though, and I'd like to know the name of the attribute as well, so I can infer the object to find
Piotr Solnica
@solnic
Jun 27 2016 14:59
@heeton you could have sth like def exists?(type, id); …; end
Alex Heeton
@heeton
Jun 27 2016 14:59
Yea, just realised that
What a stupid question :P
Sorry :)
Piotr Solnica
@solnic
Jun 27 2016 14:59
and then do required(:author_id).filled(:int?, exists?: Author)
oh no worries :)
Alex Heeton
@heeton
Jun 27 2016 15:09
@solnic Works nicely
Tim Riley
@timriley
Jun 27 2016 22:42
Anyone seen errors like Code Climate encountered an exception: CodeClimate::TestReporter::InvalidPayload on Travis lately?
Tim Riley
@timriley
Jun 27 2016 22:52
Hmm, I seem to have fixed it somehow, nm!