Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Sep 16 14:29
    klas-s starred dry-rb/dry-initializer
  • Sep 16 07:54

    flash-gordon on release-1.5

    (compare)

  • Sep 16 05:03
    ewertoncodes starred dry-rb/dry-monads
  • Sep 15 22:41
    Samsinite opened #426
  • Sep 15 22:41
    Samsinite labeled #426
  • Sep 15 22:41
    Samsinite labeled #426
  • Sep 15 22:29
    lippytm starred dry-rb/dry-initializer
  • Sep 15 21:07
    andyw8 starred dry-rb/dry-auto_inject
  • Sep 15 19:37
    krdprog starred dry-rb/dry-initializer
  • Sep 15 19:37
    krdprog starred dry-rb/dry-types
  • Sep 14 15:34
    obahareth starred dry-rb/dry-system
  • Sep 14 08:00
    flash-gordon closed #91
  • Sep 14 08:00

    flash-gordon on master

    Fix typo The text mentions `.d… Merge pull request #91 from Spo… (compare)

  • Sep 14 07:58
    flash-gordon closed #425
  • Sep 14 07:58
    flash-gordon commented #425
  • Sep 13 21:18
    Quintasan edited #425
  • Sep 13 21:16
    Quintasan labeled #425
  • Sep 13 21:16
    Quintasan labeled #425
  • Sep 13 21:16
    Quintasan opened #425
  • Sep 13 20:35
    Spone review_requested #91
Piotr Solnica
@solnic
@joevandyk atm dry-web is very alpha, if you’re ok with that then I’d be nice if you gave it a go
also, it only supports roda atm, but we’re gonna add other routing front-ends soon
ie dry-web-hanami
Joe Van Dyk
@joevandyk
there’s no UI right now btw, just json
dan-klasson
@dan-klasson
@solnic sure. i wouldn't mind recommend that too. but his question is not framework specific right?
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