Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 13 15:58
    rokhimin starred dry-rb/dry-matcher
  • Dec 13 08:53
    flash-gordon labeled #376
  • Dec 13 08:44
    solnic commented #376
  • Dec 12 21:34
    flash-gordon commented #376
  • Dec 12 21:34
    flash-gordon labeled #376
  • Dec 12 21:34
    flash-gordon opened #376
  • Dec 12 19:32
    RyanLafferty starred dry-rb/dry-types
  • Dec 12 05:53
    technofreak starred dry-rb/dry-monads
  • Dec 12 00:14
    thekuwayama starred dry-rb/dry-monads
  • Dec 11 09:29
    blasterun starred dry-rb/dry-monads
  • Dec 11 08:34
    flash-gordon closed #115
  • Dec 11 08:34
    flash-gordon commented #115
  • Dec 11 08:31

    flash-gordon on v1.3.3

    (compare)

  • Dec 11 08:30

    flash-gordon on master

    Bump version to 1.3.3 (compare)

  • Dec 11 08:30

    flash-gordon on master

    Update CHANGELOG (compare)

  • Dec 10 23:46
    johnmaxwell commented #116
  • Dec 10 21:54

    flash-gordon on master

    Halt with mutable backtrace Ex… Merge pull request #116 from jo… (compare)

  • Dec 10 21:54
    flash-gordon closed #116
  • Dec 10 21:54
    flash-gordon commented #116
  • Dec 10 21:49
    johnmaxwell commented #116
Andy Holland
@AMHOL
:joy:
I would've believed that you know
Too gullible
Luca Guidi
@jodosha
:100: :star2: :confetti_ball:
Piotr Solnica
@solnic
@jodosha :dancers:
Piotr Solnica
@solnic
@AMHOL thoughts on how to tackle complex error messages when you need more data than just input for a rule?
Andy Holland
@AMHOL
Not sure I understand fully, do you have an example?
Piotr Solnica
@solnic
ie you want to generate a message and provide a list of possible values that are dynamic, so you can’t hardcode it in the schema
basically every use case where a message needs data that come from some external source
Andy Holland
@AMHOL
I don't think we should do that
Piotr Solnica
@solnic
but it’s needed :)
Andy Holland
@AMHOL
lol
Piotr Solnica
@solnic
I told you I have all kinds of validation use cases :)
I have a couple of messages that need to do extra db lookups to provide meaningful feedback
Andy Holland
@AMHOL
What if there's a list of 500 values returned?
Piotr Solnica
@solnic
don’t get stuck on this silly example :)
it’s your job to construct that message, not dry-v's
but we need an interface to allow that
that’s what I’m asking
basically an equivalent of :message option in AM::V
with the exception of “option” part, because options in dsl are a horrible horrible idea (I’ll be repeating that all the time)
Andy Holland
@AMHOL
Shouldn't they be custom validations/integrations?
Piotr Solnica
@solnic
well, you could provide your own Messages implementation, subclass one of the built-in ones, and have a customized lookup (or whatever it’s gonna be called eventually)
Andy Holland
@AMHOL
Sorry, think I still don't understand exactly what you're asking :laughing:
Piotr Solnica
@solnic
@AMHOL you define a rule ie key(:book) { |book| book.publish? } and that predicate returns false when a system-level setting “publishing_turned_off” is set and it needs to set a message “sorry, but book publishing is turned off until %{date}” and date is retrieved from the database.
so it’s a dynamic validation that changes over time and needs a completely dynamic error message that requires data from an external system (a db)
Andy Holland
@AMHOL
Hmm, not sure without options hash lol
Piotr Solnica
@solnic
@AMHOL I’ll figure something out :muscle:
Andy Holland
@AMHOL
:)
I'm sure you will
Hannes Nevalainen
@kwando
@solnic I'd like to inject a custom "key mapper" function to a form validation schema
for instance if my input hash has uppercase keys I would like the mapper to downcase them
Hannes Nevalainen
@kwando
class MySchema < Dry::Validation::Schema::Form
  key(:database_url){ |f| f.filled? }
end

schema = MySchema.new(key_map: -> x { x.to_s.downcase })
schema.call({'DATABASE_URL' => '<url to database>'}).params #=> {database_url: '<url to database>'}
Piotr Solnica
@solnic
@kwando sorry schema is not a data mapper
Hannes Nevalainen
@kwando
buzz, wrong answer
=P
I understand =)
Piotr Solnica
@solnic
I'd give you a better explanation but I'm not feeling well today so my brain is kind of partially working
Hannes Nevalainen
@kwando
@solnic no worries =)
take care, do some rest
Piotr Solnica
@solnic
That is my plan
Vojtěch Kusý
@wojtha
Hi there. I finally found gitter chat for DryRb :) big :+1: for all the components.
I've played with AutoInject last night and created 3 more DI strategies for it. What do you guys @solnic @AMHOL think?
Andy Holland
@AMHOL
@wojtha not sure about the getter/setter inject, but the key inject is something me and @solnic have discussed in the past
Was thinking of an interface more like include MyApp::Inject(messenger: 'message.store') myself
Would be good to see what @solnic thinks though
I haven't really worked on that gem
Vojtěch Kusý
@wojtha
Yeah. Hash init came to my mind as well. But for now I sticked with AutoInject's default init.
For getter/setter: these are fallbacks for Rails controllers or similar objects as I wrote in the description.