These are chat archives for dry-rb/chat

5th
Sep 2016
Tim Riley
@timriley
Sep 05 2016 09:52
@wafcio remember a while ago you asked about why the db:sample_data rake task existed? This is why: http://feedproxy.google.com/~r/GiantRobotsSmashingIntoOtherGiantRobots/~3/18dkzEU_RDM/priming-the-pump
Piotr Solnica
@solnic
Sep 05 2016 13:24
irb(main):003:0> Dry::Validation.Schema { required(:data) { str? | array? } }.(data: {}).messages
=> {:data=>["must be a string or must be an array"]}
ᕦ( ~ ◔ ᴥ ◔ ~ )੭━☆゚.*・。゚
@fran-worley ^^ :D
Fran Worley
@fran-worley
Sep 05 2016 19:16
@solnic awesome that one has been a long time coming!
Oh and what's the reason behind the change from .() to .call() you've been making in dry recently? I just want to know so I'm consistent
Piotr Solnica
@solnic
Sep 05 2016 19:18
@fran-worley uhm, an accident, I’ll change it back to .()
Piotr Solnica
@solnic
Sep 05 2016 20:22
Finished in 7.78 seconds (files took 1.29 seconds to load)
2462 examples, 0 failures
@fran-worley w000000000000000000000000000000000000000000t ^_^ :tada: :dancers:
Fran Worley
@fran-worley
Sep 05 2016 20:24
@solnic not too shabby. I'm back by the way. Not going to bed until I've fixed one of my failing dry tests!
Piotr Solnica
@solnic
Sep 05 2016 20:25
@fran-worley cool cool w/b :)
my fav part:
dry-rb/dry-validation (or-messages«) % be ruby benchmarks/benchmark_form_invalid.rb
Warming up --------------------------------------
ActiveModel::Validations
                       139.000  i/100ms
dry-validation / schema
                       745.000  i/100ms
dry-validation / form
                       654.000  i/100ms
Calculating -------------------------------------
ActiveModel::Validations
                          1.389k (± 1.9%) i/s -      6.950k in   5.005455s
dry-validation / schema
                          7.467k (± 1.7%) i/s -     37.995k in   5.089817s
dry-validation / form
                          6.686k (± 1.7%) i/s -     34.008k in   5.088249s

Comparison:
dry-validation / schema:     7467.1 i/s
dry-validation / form:     6685.6 i/s - 1.12x slower
ActiveModel::Validations:     1389.0 i/s - 5.38x slower
:D
Fran Worley
@fran-worley
Sep 05 2016 20:26
:) that is very cool. Any ideas on why these guys are failing? I've pulled from master and updated everything...
rspec ./spec/integration/schema/check_rules_spec.rb:30 # Dry::Validation::Schema using high-level rules composing rules fails when red and blue are not filled 
rspec ./spec/integration/hints_spec.rb[1:1:2] # Validation hints with yaml messages skips type-check rules
rspec ./spec/integration/hints_spec.rb[1:1:1] # Validation hints with yaml messages provides hints for additional rules that were not checked
rspec ./spec/integration/hints_spec.rb[1:2:1] # Validation hints with i18n messages provides hints for additional rules that were not checked
rspec ./spec/integration/hints_spec.rb[1:2:2] # Validation hints with i18n messages skips type-check rules
Piotr Solnica
@solnic
Sep 05 2016 20:26
@fran-worley oh I didn’t push it all yet
gimme a minute or two ok?
Fran Worley
@fran-worley
Sep 05 2016 20:26
They are all failing because the messages all have a 'can't be defined' item which is unexpected
This message was deleted
Fran Worley
@fran-worley
Sep 05 2016 20:32
Sorted :) Ta @solnic
Piotr Solnica
@solnic
Sep 05 2016 20:32
@fran-worley ook we’re 100% green, 0 pending specs :)
now there’s one “big” dillemma, should we stick to the existing rule syntax with left.gt?(right) or change it to gt?(left, right)
I think it should be possible to deprecate it w/o breaking the API
Fran Worley
@fran-worley
Sep 05 2016 20:34
The only thing is that left.gt?(right) possibly reads better as it is closer to left > right
is there a benefit to changing it ?
Piotr Solnica
@solnic
Sep 05 2016 20:35
dunno tbh, it would be sort-of more consistent with the reset stuff like required(:foo) { gt?(1) }
I guess we should stick to the one we have and see how others feel about it
Fran Worley
@fran-worley
Sep 05 2016 20:37
I'm thinking that unless there is a clear benefit (and/or people want it changed) we should probably avoid changing things.
Piotr Solnica
@solnic
Sep 05 2016 20:40
sure, I just remember some folks getting confused with args order when defining custom predicates + high-level rules
that’s why I thought that maybe we should change the syntax
Fran Worley
@fran-worley
Sep 05 2016 20:41
Ah well that makes a bit more sense. We could open a topic in discuss with examples? Or just do it and hope for the best...
Nikita Shilnikov
@flash-gordon
Sep 05 2016 21:17
@solnic your last commits in dry-v are unverified https://github.com/dry-rb/dry-validation/commits/master
Piotr Solnica
@solnic
Sep 05 2016 21:18
@flash-gordon I saw that
Nikita Shilnikov
@flash-gordon
Sep 05 2016 21:18
I gotta admit, it's a bit tricky not to mess up with git and signatures, I do this from time to time
Piotr Solnica
@solnic
Sep 05 2016 21:18
was messing with my email settings…and forgot to update one thing in one place :)
Piotr Solnica
@solnic
Sep 05 2016 22:22
@dsounded FYI dry-rb/dry-validation@9fe86be
Piotr Solnica
@solnic
Sep 05 2016 22:30
@fran-worley one more thing, I’ll be turning off hints by default…so basically schema.({}).messages will return failures exlusively and to get hints you’ll be able to do sth like schema.({}).hints…although API suggestions are most welcome
actually…maybe we should do #errors and #hints?
or #failures and #hints? hmm
Fran Worley
@fran-worley
Sep 05 2016 22:36
Errors and hints makes the most sense to me. Anyone who uses dry and then a simple_form type HTML helper won't see the hints anyway as it defaults to messages.first