Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 09:13

    solnic on release-0.17

    Add information about built-in … (compare)

  • 09:11

    solnic on add-settings-section

    (compare)

  • 09:11

    solnic on master

    Add information about built-in … (compare)

  • 09:11
    solnic closed #145
  • 07:26
    Yuki-Inoue starred dry-rb/dry-monads
  • Apr 07 15:30

    davydovanton on rack-middleware-compat-with-rack-builder

    (compare)

  • Apr 07 15:30

    davydovanton on master

    Ensure `Dry::Monitor::Rack::Mid… Merge pull request #37 from dry… (compare)

  • Apr 07 15:30
    davydovanton closed #37
  • Apr 07 14:58
    JPalka starred dry-rb/dry-monads
  • Apr 07 14:49
    dry-bot commented #37
  • Apr 07 14:42
    jodosha edited #37
  • Apr 07 14:42
    jodosha review_requested #37
  • Apr 07 14:42
    jodosha labeled #37
  • Apr 07 14:42
    jodosha review_requested #37
  • Apr 07 14:42
    jodosha assigned #37
  • Apr 07 14:42
    jodosha opened #37
  • Apr 07 14:37

    jodosha on rack-middleware-compat-with-rack-builder

    Ensure `Dry::Monitor::Rack::Mid… (compare)

  • Apr 07 11:56
    davydovanton synchronize #145
  • Apr 07 11:56

    davydovanton on add-settings-section

    Update docsite/source/settings.… (compare)

  • Apr 07 11:43
    davydovanton commented #145
Krzysztof Wawer
@wafcio
ok
Piotr Solnica
@solnic
uhm, it’s pretty messed up right now, no wonder it got you confused
I’ll try to fix it later today or tomorrow
Piotr Solnica
@solnic
@wafcio I fixed that issue we talked about yesterday with error messages hash structure. it’s in master
Piotr Solnica
@solnic
good news people, "validation hints” landed on master, here’s a higher-level spec which shows current behavior, seems innocent but it’s pretty crucial - we provide all validation messages even though not all predicates are being applied (because it makes no sense). This is the very first step. Soon I’ll start experimenting with optimizations like dropping some messages when other have higher priority and expose an interface to provide your own optimization rules so that validation messages will not have redundant information.
Piotr Solnica
@solnic
dryrb/dry-validation#40
@AMHOL @kwando I can haz some feedback? ^
it’s a pretty big addition
Andy Holland
@AMHOL
:joy:
I'll take the red pill
Piotr Solnica
@solnic
haha
Hannes Nevalainen
@kwando
@solnic niceness! I'll have to use it before I can have better feedback =)
Hannes Nevalainen
@kwando
dry-validation for validating ENV on boot => friendly error messages <3
Piotr Solnica
@solnic
Yep. One of the many use cases

validateallthethings

Whoops
Hannes Nevalainen
@kwando
markdown =P
Piotr Solnica
@solnic
Hashtag goes wrong ;)
Andy Holland
@AMHOL

hashtaggoeswrong

Chris Richards
@cmrichards
Hey solnic, thanks for all your work on Virtus
Piotr Solnica
@solnic
@cmrichards hey, my pleasure, although I’m no longer working on it ;)
Chris Richards
@cmrichards
I know, that's why I'm saying thanks!
Any idea when dry-data and dry-validation will be ready enough to use in place of Virtus?
@solnic
Piotr Solnica
@solnic
depends on what you need :)
I stopped using virtus already fwiw
philosophy is quite different than in virtus
so it requires a different approach
which is why it cannot be treated as a replacement
Chris Richards
@cmrichards
@solnic I use Virtus only for web forms in rails. I include activerecord validations. It works perfectly.
It's hard to imagine anything simpler
Piotr Solnica
@solnic
really? dry-data/validation is not just simpler but more powerful :D
Chris Richards
@cmrichards
Great, i'll try it.
Piotr Solnica
@solnic
I'm wrapping up stuff for dry-v 0.4.0
Chris Richards
@cmrichards
If I have a User class, "class User < Dry::Data::Struct", can you just do User.new(params[:user]) to create an instance?
Piotr Solnica
@solnic
it's gonna reach 1.0.0 once I figure out how to optimize errors, this part will need quite some work
Chris Richards
@cmrichards
It's not clear in the docs
Piotr Solnica
@solnic
yes, although structs are strict wrt hash input, it'll raise when keys are missing
it's not a replacement for virtus models
ie dry-v builds up a coercible hash using dry-d for Schema::Form, it does form coercions for you and symbolizes keys
there are different types of hashes in dry-d, so you have a strict one, a non-strict one, non-strict with symbolized-keys (that's the one that dry-v is using)
Piotr Solnica
@solnic
dry-d structs and values are meant to be used as your domain data types, strictness is encouraged too
not just wrt type primitives but also any possible constraints
there’s a lot tbd to improve errors coming from dry-d though, it’s a bit rough right now
Chris Richards
@cmrichards
So how would you do something simple like this in drd? https://gist.github.com/cmrichards/364920a5ffd6c49420c5
Piotr Solnica
@solnic
gimme a minute, I actually just added new features to dry-v to allow this
Piotr Solnica
@solnic
class BarcodeSchema < Dry::Validation::Schema::Form
  key(:barcode, &:filled?)
  key(:job_number) { |v| v.none? | v.int? }
  key(:sample_number) { |v| v.none? | v.int? }

  rule(:barcode_only) do
    rule(:barcode) ^ (rule(:job_number) | rule(:sample_number))
  end

  def self.messages
    Dry::Validation::Messages.default.merge(
      en: { errors: {
        barcode_only: 'Can only enter data into barcode OR job/sample fields, not both'
      }}
    )
  end
end
@cmrichards something like that will be possible starting from dry-v 0.4.0
I’m not sure if people will like using logic in the long term so maybe we can introduce higher-level macros, but I dunno, I kinda like it, forces you to think in terms of pure logic
Chris Richards
@cmrichards
I agree.
It looks pretty good