Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 17:01
    emaraschio starred dry-rb/dry-monitor
  • Apr 04 15:38
    nepalez closed #74
  • Apr 04 15:38
    nepalez commented #74
  • Apr 04 10:40
    qortex commented #400
  • Apr 04 08:47
    flash-gordon closed #400
  • Apr 04 08:47
    flash-gordon commented #400
  • Apr 03 21:18
    qortex starred dry-rb/dry-types
  • Apr 03 21:14
    qortex edited #400
  • Apr 03 21:14
    qortex labeled #400
  • Apr 03 21:14
    qortex opened #400
  • Apr 03 19:18
    landongrindheim commented #74
  • Apr 02 19:47
    kamilski81 starred dry-rb/dry-monads
  • Apr 02 17:26
    waleedasif322 starred dry-rb/dry-types
  • Apr 02 14:59
    sskylar starred dry-rb/dry-monads
  • Apr 02 13:51
    kirin121 starred dry-rb/dry-container
  • Apr 02 10:56

    davydovanton on performance-improvements-for-rack-monitorring

    (compare)

  • Apr 02 10:55

    davydovanton on master

    Improve memory allocation for R… Merge pull request #34 from dry… (compare)

  • Apr 02 10:55
    davydovanton closed #34
  • Apr 02 02:25
    DaiAoki starred dry-rb/dry-types
  • Apr 01 14:39
    davydovanton commented #34
Piotr Solnica
@solnic
@backus sure, just merge it
John Backus
@backus
Done
Alex Semyonov
@alsemyonov
:tada:
Piotr Solnica
@solnic
really cool, thanks for this
Pablo Herrero
@pabloh
Hey, guys, do you how to compile your validation errors to produce symbol codes instead of string messages?.
like, { name: [:required] } instead of { name: ['must be filled'] }?
Jeff Dickey
@jdickey
@pabloh what I'd do is write a mapper class around the validation result you're handed back to give you the symbols rather than strings you want. Since the strings are predictable, parsing and rebuilding should be easy — but beyond the core functionality of the validation class itself
look at the source, figure out what all the strings are, write tests that produce validation errors producing each of those strings and proving that your wrapper does the translation correctly, and then make those tests green.
Piotr Solnica
@solnic
@pabloh see Result#message_set it returns message objects, you should be able to construct something from this
vetcovetco
@vetcovetco
Hello. I really like the look, feel, performance of dry-validation. I want to replace ActiveRecord with it. I have some questions about behavior I find odd. Here's a paste: https://gist.github.com/vetcovetco/ff6bab9f30ad8d954edfcaca6b135199
Also, I see that I can get an errors-object back via #call; is there a way to access the attributes-and-their-values, too? I want to use the DV object in an HTML form.
Oh, NM on that last question, I see ::Form and #result.
Er, #output.
vetcovetco
@vetcovetco
Hrm. This isn't a drop-in replacement for AR or AM. Things like form_for wanting #model_name.
vetcovetco
@vetcovetco
How can I get my form to show the values already present in the object?
Tim Riley
@timriley
#to_h is probably better to use than #output, @vetcovetco. #output will disappear at some point. BTW, the result object also quacks a bit like a hash, so you can also just do result[:my_attr_name]
As for getting a rails form to work, if you don’t want to roll any of your own integration code, your best bet right now would be to use a gem like reform, which integrates with dry-v
Tim Riley
@timriley
I think your rule should probably be something like this: required(:name).filled(min_size?: 1, max_size?: 64)
Pablo Herrero
@pabloh
@vetcovetco, I'm think you are not suppose to define a field several times, since it will override all the previous definitions. Though you can put all your conditions on a single line like @timriley showed.
Calinoiu Alexandru Nicolae
@alexandru-calinoiu
Hi, I am trying to figure out what is the best way to boot different deps based on env, share your thoughts here https://discuss.dry-rb.org/t/best-practices-on-how-to-boot-dependescies-based-on-env/254
vetcovetco
@vetcovetco
@timriley Thanks for your replies! Ah, multiple predicates in 1 go. Okay. And thanks for the pointer to reform, never heard of it.
Piotr Solnica
@solnic
dry-rb/dry-schema#1 <= such PR :scream_cat:
that so edgy version even those from us who are living on the edge cannot have it :smile:
Piotr Solnica
@solnic
@gotar super edgy ;)
I’m cleaning this up
should be mergable in a second
Gustavo Caso
@GustavoCaso
What a PR @solnic :smile:
John Backus
@backus
Small gotcha that I just ran into
require 'dry/types'

type = Dry::Types::Definition.new(Object)

class Foo
end

class Decorator < SimpleDelegator
end

type.try(Foo.new).success?                # => true
type.try(Decorator.new(Foo.new)).success? # => false
Not totally sure what behavior I think is correct here!
SimpleDelegator does inherit from BasicObject so that is why this happens
The practical part of me doesn't want to think about the fact that SimpleDelegator is a BasicObject
but also it seems like special casing delegators might be weird
thoughts @solnic @flash-gordon?
Nikita Shilnikov
@flash-gordon
@backus heh, yes, Types::Object isn't meant to do any checks, it should act as Identity, i.e. -> (v) { v }. I'd say this is a bug. I think we should rename it to Types::Any or Types::Bottom for clarity
John Backus
@backus
We have it aliased to Types::Any it our app
so I'd endorse Any
Nikita Shilnikov
@flash-gordon
yeah bottom is too geeky :)
John Backus
@backus
heh
Nikita Shilnikov
@flash-gordon
but maybe we could attract some folks from Haskell with that lol
John Backus
@backus
I write Ruby so I don't have to read wikipedia pages about category theory :P
John Backus
@backus
Haha same bug just bit me again
Adam Gwozdowski
@agwozdowski

Hi, I have simple configuration:

class App
  extend Dry::Configurable

  setting :redis do
    setting :url
  end

  setting :name
end

And validation schema:

ConfigurationSchema = Dry::Validation.Schema do
  required(:name).maybe(:str?)
  required(:redis).schema do
    required(:url).maybe(:str?)
  end
end

When I run:

ConfigurationSchema.(App.config.to_h).inspect

Receive error:
errors={:redis=>[\"must be a hash\"]}

Because to_h method doesn't change NestedConfig into hash. What is the best way to handle this case? Thanks for help!

Adam Gwozdowski
@agwozdowski
And one more question. Why, when I set default value false config return nil?
require 'dry-validation'
class App
  extend Dry::Configurable
  setting :name, false
end
App.config.name
Andy Holland
@AMHOL
@agwozdowski that was fixed dry-rb/dry-configurable@3948c0d, just hasn't been released yet
Adam Gwozdowski
@agwozdowski
Thanks @AMHOL! Do you know how to handle previous problem, with to_h method? :)
Piotr Solnica
@solnic
ah yes, @mensfeld is a happy dry-v user :)
Andy Holland
@AMHOL
@agwozdowski I just released dry-configurable 0.7.0, try updating, it should work then