Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Feb 18 21:30
    ArtemRakov starred dry-rb/dry-monads
  • Feb 18 16:10
    marselmustafin starred dry-rb/dry-monads
  • Feb 18 09:52
    preetsethi starred dry-rb/dry-initializer
  • Feb 17 23:12
    Karnaj starred dry-rb/dry-types
  • Feb 17 23:12
    Karnaj starred dry-rb/dry-monads
  • Feb 16 23:37
    asoules starred dry-rb/dry-system
  • Feb 16 20:37

    dry-bot on master

    [devtools] sync (compare)

  • Feb 16 20:37

    flash-gordon on master

    Update CHANGELOG (compare)

  • Feb 16 20:36

    flash-gordon on v1.3.1

    (compare)

  • Feb 16 20:34

    dry-bot on master

    [devtools] sync (compare)

  • Feb 16 20:33

    flash-gordon on master

    Fix version number (compare)

  • Feb 16 20:32

    dry-bot on master

    [devtools] sync (compare)

  • Feb 16 20:32

    flash-gordon on master

    Update CHANGELOG (compare)

  • Feb 16 20:27

    flash-gordon on master

    Bump version to 1.3.1 (compare)

  • Feb 16 20:26

    flash-gordon on impove-predicate-inferrer

    (compare)

  • Feb 16 20:26

    flash-gordon on master

    Infer hash? predicate for hash … Merge pull request #395 from dr… (compare)

  • Feb 16 20:26
    flash-gordon closed #395
  • Feb 16 20:26
    dry-bot commented #395
  • Feb 16 20:24
    flash-gordon opened #395
  • Feb 16 20:23

    flash-gordon on impove-predicate-inferrer

    Infer hash? predicate for hash … (compare)

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
Maciej Mensfeld
@mensfeld
@AMHOL I'm a very, very happy dry user :) @agwozdowski and I use it in Karafka framework as well (http://github.com/karafka/karafka)
Andy Holland
@AMHOL
@mensfeld that's good to hear, glad you're liking it, feel free to drop me a PM or open an issue if there's anything you feel could be better :)
https://github.com/karafka/karafka looks good, haven't used kafka before
Maciej Mensfeld
@mensfeld
@AMHOL thanks :) Kafka is really, really good - I have one system that works on the combination of Karafka + Dry-v + Dry-c
and you guys do a great job in terms of quality and development - I track some metrics about dry organization and really :clap: