Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
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:
Andy Holland
@AMHOL
Oh, that's awesome, would be interested in hearing more about that, enjoyed your blog post BTW :)
Maciej Mensfeld
@mensfeld
Thanks. Some people complain about more complex cases but I have one lkke that: multinested hash with internal structures + I validate it 100-5000x per second and it works :)
Andy Holland
@AMHOL
That's impressive :)
@solnic ^^
Maciej Mensfeld
@mensfeld
about the metrics and data - I'm planning to give it to you as a way to say thank you. I just need a bit more time to aggregate it in a nice way
Andy Holland
@AMHOL
Oh wow <3
Piotr Solnica
@solnic
data validation is such a complex domain that it’s gonna take years to cover maybe 80% of the cases people have heh
we have almost 3000 spec examples in dry-v repo and honestly we probably barely cover 60% of the currently supported use cases
this is pretty much crazy stuff
one thing I’d like to do in 1.0 is to simplify DSL so that there’s less ways of…doing things O_o
high level rules will definitely go away from schemas, that’ll make things much simpler already
one of the challenges is to have a DSL that is concise yet it can be 100% flexible, that’s tricky
and I don’t even want to mention cases like dynamic data structures, as in, structures that must match a pattern, instead of a strict definition
and yes folks have been asking for this :laughing:
Maciej Mensfeld
@mensfeld
@solnic I cover 100% of mine so if you change anything and need to hve external specs I can run mine for you ;)
Piotr Solnica
@solnic
sounds like a plan ;)
Maciej Mensfeld
@mensfeld
@apotonick ask me to do that from time to time as I hve 100% coverage of operations as well
Since your gems aren't considered stable by me - I prefer to cover all the things
Piotr Solnica
@solnic
you sure you wanted to mention Nick ^_^? :D
Maciej Mensfeld
@mensfeld
hahaha :P
will something bad happen?
Piotr Solnica
@solnic
anyhow, yes dry-rb gems are not stable
:bike: time, bbiab
Maciej Mensfeld
@mensfeld
I would say they are not stable but they aren't unstable ;) and if you don't hack internals they work well
Piotr Solnica
@solnic
heh yeah, we need better terminology for this stuff
Nick Sutterer
@apotonick
Haha! My stuff is usually 100% tested, but Ruby makes it too easy to "fix" internals in your project and then the next minor update breaks things... surprisingly!
@solnic There are rumors about us :beers: at grill camp or whatever the name was?! ;)
Nikita Shilnikov
@flash-gordon
grill camp :laughing:
Nick Sutterer
@apotonick
What was the name again? Haha :joy:
Nikita Shilnikov
@flash-gordon
http://railsclub.ru/en/main there're your faces ;)
Nick Sutterer
@apotonick
@flash-gordon Hahaha, yes, but I meant something else
It's in Wroclaw
Grillruby or something... god damnit, @mensfeld what's it called, again, the event in July?
Maciej Mensfeld
@mensfeld
@apotonick http://grillrb.com/ :)
Nikita Shilnikov
@flash-gordon
@apotonick haha, so you don't avoid to mention rails that much? :laughing: