Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 25 15:22
  • Jan 25 11:13
    bergpb starred dry-rb/dry-monads
  • Jan 25 10:07
    timriley synchronize #157
  • Jan 25 10:07

    timriley on remove-auto-register

    Remove `auto_register!` and add… (compare)

  • Jan 25 10:00
    timriley synchronize #157
  • Jan 25 10:00

    timriley on remove-auto-register

    Remove `auto_register!` and add… (compare)

  • Jan 25 09:49
    timriley synchronize #157
  • Jan 25 09:49

    timriley on remove-auto-register

    Remove `auto_register!` and add… (compare)

  • Jan 25 09:46
    timriley synchronize #157
  • Jan 25 09:46

    timriley on remove-auto-register

    Remove `auto_register!` and add… (compare)

  • Jan 25 09:44
    timriley synchronize #157
  • Jan 25 09:44

    timriley on remove-auto-register

    Remove `auto_register!` and add… (compare)

  • Jan 24 23:53
    timriley synchronize #157
  • Jan 24 23:53

    timriley on remove-auto-register

    Remove `auto_register!` and add… (compare)

  • Jan 24 23:32
    timriley synchronize #157
  • Jan 24 23:32

    timriley on remove-auto-register

    Remove `auto_register!` and add… (compare)

  • Jan 24 23:31
    timriley edited #157
  • Jan 24 23:31
    timriley opened #157
  • Jan 24 23:30
    aristotelesbr2014 starred dry-rb/dry-monads
  • Jan 24 23:29

    timriley on remove-auto-register

    Remove `auto_register!` and add… (compare)

Joe Van Dyk
@joevandyk
@dan-klasson i’m asking what framework people recommend ;)
or libs or whatever
i haven’t kept up in the last few years
dan-klasson
@dan-klasson
@joevandyk oh, well that is a good question.
Piotr Solnica
@solnic
I don’t recommend frameworks, I don’t like frameworks :)
Joe Van Dyk
@joevandyk
set of cohesive libraries then
w/ generators hopefully
dan-klasson
@dan-klasson
@joevandyk if you want cohesive libraries, you're in the right channel
Piotr Solnica
@solnic
I’d defo recommend trying out roda for the http part
dan-klasson
@dan-klasson
@joevandyk there is no silver bullet when it comes to dev. it all depends on what you're requirements are. but if i were you i would definitely give weight to what @solnic says
Piotr Solnica
@solnic
what kind of “formats” do you need to support?
fwiw I’m planning to add a new data transformation lib to dry-* family later this year
I don’t like rom-mapper anymore :)
Joe Van Dyk
@joevandyk
at first glance i prefer http://hanamirb.org/guides/actions/overview/ over roda i think
@solnic imagine taking an ebay product in their api format and converting that to what amazon needs for their api
and what bing needs
so could be taking something in some weird xml format, applying biz logic, then send to whatever json format another service needs
i like hanami’s actions more than roda (at first glance) because it’s easy to see how to structure the code / actions
on a team i think having the convention is important
Piotr Solnica
@solnic
I like roda routing tree because you need to look at just one place to see what your app is doing on the http side
vs jumping between router dsl and action files
the way we use roda is that http-specific code lives in the routing trees, everything else is core app APIs
so basically http part of the whole system becomes an extension on top of the core app
I mean, that’s how it works in dry-web
Joe Van Dyk
@joevandyk
hm
Piotr Solnica
@solnic
I feel like this is something many people are still missing
dan-klasson
@dan-klasson
@solnic sure, i like that too. but that's not what he is specifically asking for
how weird is the xml, and how complicated is the business logic?
Piotr Solnica
@solnic
for complex data transformations you could look into functional approach with transproc (it’s the backend for rom)
Joe Van Dyk
@joevandyk
@solnic didn’t that get changed to dry-transaction?
Piotr Solnica
@solnic
nope, dry-transaction is for composing business transactions with explicit error handling
Joe Van Dyk
@joevandyk
is transproc going to be put into dry-*?
Piotr Solnica
@solnic
I’d like that, yes
we’re actually thinking about a dry-fp project with various functional APIs that many projects can rely on
there’s a big portion of transproc that could be moved there
then transproc could become a collection of data-transformation functions that are composable
and I’d like to extend it with more advanced features, like type-safety and guarded transformations with various fallback and error handling mechanisms
Nikita Shilnikov
@flash-gordon
@timriley I think I found something dry-rb/dry-transaction#19 :)
Tim Riley
@timriley
@flash-gordon ah wow, nice work! Thanks :)
Gabriel Gayan Fanta
@ggayan

Hello folks, I wonder if there is a recommended (or better) way for validating related values in dry-validations, e.g.:

schema = Dry::Validation.Form do
  key(:a).required(:int?, gteq?: 0)
  key(:b).required(:int?)
  rule(:b_gt_a) do
    value(:b).gt?(value(:a))
  end
end

result = schema.call(params)

I noticed that the validation message is plain, for example, if I pass {a: 0, b: 0}, the schema says that b must be greater than 0, but it would be really helpful for the client to know that it must be greater than a

Tim Riley
@timriley
@ggayan that’s just the default message for that kind of validation. You can override it with your own errors.b_gt_a error message i18n or YML file key
Here’s an example where I’ve just done it locally to the schema (not the best approach for widespread usage, but easy for me to test in isolation):
schema = Dry::Validation.Form do
  configure do
    def self.messages
      Dry::Validation::Messages.default.merge(
        en: { errors: { b_gt_a: 'b must be greater than a' } }
      )
    end
  end

  key(:a).required(:int?, gteq?: 0)
  key(:b).required(:int?)
  rule(:b_gt_a) do
    value(:b).gt?(value(:a))
  end
end

result = schema.call({a: 0, b: 0})
result.messages
# => {:b_gt_a=>["b must be greater than a"]}
Tim Riley
@timriley
http://dry-rb.org/gems/dry-validation/error-messages/ has lots of info about error messages, FYI :)
Gabriel Gayan Fanta
@ggayan
great, so the rule name can be used to modify the message
thanks!
Tim Riley
@timriley
Yep!
@nepalez what in particular were you planning to release with dry-initializer 0.1.0? the Mixin change?
Tim Riley
@timriley
If so, I think it’s OK to wait just a bit longer...
Tim Riley
@timriley
@nepalez I was going to leave a few more comments on that PR, but it’s already merged! I’ll just do them in new issues, then