Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 21 21:52
    aristotelesbr starred dry-rb/dry-system
  • Jan 21 18:20
    serogers starred dry-rb/dry-initializer
  • Jan 21 17:08
    hiendinhngoc starred dry-rb/dry-types
  • Jan 21 14:27
    jaxtonkael starred dry-rb/dry-monads
  • Jan 21 13:17
    timriley edited #209
  • Jan 21 13:07
    timriley edited #209
  • Jan 21 13:06
    timriley edited #209
  • Jan 21 13:06
    timriley edited #209
  • Jan 21 13:05
    timriley edited #209
  • Jan 21 12:44
    solnic commented #209
  • Jan 21 12:22
    timriley commented #209
  • Jan 21 12:18
    timriley synchronize #209
  • Jan 21 12:18

    timriley on container-exports

    Fix with_tmp_directory spec hel… Allow containers to configure t… Fix broken spec and 29 more (compare)

  • Jan 21 12:15
    timriley ready_for_review #209
  • Jan 21 12:14
    timriley review_requested #209
  • Jan 21 12:14
    timriley review_requested #209
  • Jan 21 12:14
    timriley review_requested #209
  • Jan 21 12:14
    timriley edited #209
  • Jan 21 12:14
    timriley edited #209
  • Jan 20 15:09
    raccube starred dry-rb/dry-types
Julien Blanchard
@julienXX
Hello is there a way to reject unknown keys with dry-validation?
Piotr Solnica
@solnic
@julienXX it ignores unspecced keys by default
Gustavo Caso
@GustavoCaso
@here I have a Rails app with the typical setup, but everything been auto loaded from the app folder.
Inside the app folder we have a services folder that contain service objects, I was thinking about moving to a container base implementation
Has anyone tried before ? Any advice ?
Nikita Shilnikov
@flash-gordon
@solnic I've released 0.10.2 with a tiny bugfix
Piotr Solnica
@solnic
oh boy :)
Hannes Nevalainen
@kwando
Damn, I wanna do stuff in Elixir but I'm missing dry-validation to much sigh
Piotr Solnica
@solnic
hah yeah, once you start using such a solution it becomes an integral part of your system and the way you think about handling input so…I’m not surprised :)
Nick Sutterer
@apotonick
Hahaha
BTW @solnic I want to make massive changes to Reform so that it's basically just a presenter around dry-v
Piotr Solnica
@solnic
@apotonick let’s talk this through then, I’m working on dry-v + dry-schema 0.11 in May
Nick Sutterer
@apotonick
Yeah, I mean all Reform does in addition to your work is: presentation object, mapping between DB structure and the form object, and, and that's what is underestimated all the time, the deserialization of the incoming document
That's where Representable comes into play
And I think we should also discuss how ROM could do the structural mapping part of Reform, as I am absolutely not interested in repeating what's been done better, before
Pablo Herrero
@pabloh
When using dry-transaction, Is possible to modify the context within a step?
Nikita Shilnikov
@flash-gordon
@pabloh wdym by saying "context"? A transaction just accepts arguments and returns a result, it doesn't have any mutable internal state
Pablo Herrero
@pabloh
Doesn't it keep a context along the way where you can grab values?
Is not possible to store partial results somewhere there to use on subsequent steps?
Nikita Shilnikov
@flash-gordon
you just pass them from one step to another
I use keyword args for passing several values at once
def my_step(value_1: , **rest)
  value_1_transformed = do_something(value_1)
  Right(value_1: value_1_transformed, **rest)
end
@pabloh like this^
Pablo Herrero
@pabloh
So you need to make your result value a hash?
Nikita Shilnikov
@flash-gordon
I use hashes, but it's up to you. You also can define a custom step http://dry-rb.org/gems/dry-transaction/custom-step-adapters/, but this is advanced usage :)
Pablo Herrero
@pabloh
My question is do you have to put a hash besides the actual value in the result to have some kind of context?
Nikita Shilnikov
@flash-gordon
can be arrays also, or you can define your own "context" object
the main point is that dry-transaction doesn't have a mutable state inside
Pablo Herrero
@pabloh
I understand that, I meant "change" the context in the same way the state monad updates its "state".
Nikita Shilnikov
@flash-gordon
yeah, in this sense a new type of step will be useful, atm we don't have any special "context" object
txn = define_transaction do
  custom_step_adapter 'step_1', using: :value_1
  custom_step_adapter 'step_2', using: :value_2
  map 'step_3'
end

txn.call(value_1: 1, value_2: 2)


def my_step(value_1)
  value_1 + 1
end

def my_step(value_2)
  value_2 + 1
end

def step_3(context)
  context # { value_1: 2, value_2: 3 } 
end
@pabloh for example^
Nick Sutterer
@apotonick
@pabloh That's basically and exactly what a TRB operation provides (sorry for high-jacking)
Pablo Herrero
@pabloh
Ok, will check it out.
Nick Sutterer
@apotonick
@pabloh There a "context" object, we call it options which is basically a hash, and passed from step to step (per default) http://trailblazer.to/gems/operation/2.0/#state-and-result
Pablo Herrero
@pabloh
So you just store the actual result in :model as a convention?
Pablo Herrero
@pabloh
@apotonick, any reason yoy prefered that approach instead of storing the result separately?
Nick Sutterer
@apotonick
@pabloh The result is stored separately! The options hash scopes, and knows who added what
However, most operations don't need that, so the "human" interface is very simple and looks "global", but it isn't. It took months to design it
Pablo Herrero
@pabloh
I see, I think I could take a dive in the code in order to fully get it after I check out the docs some more.
George Millo
@georgemillo
hey, when I clone the dry-types repo and run specs, I get failures for all tests that involve a maybe type
I imagine that this is something to do with dry-monads not being loaded?
how do I make the tests pass?
Nikita Shilnikov
@flash-gordon
@georgemillo run with rake
George Millo
@georgemillo
aha
thanks
looks like rake runs two rspec suites
what's going on there?
Nikita Shilnikov
@flash-gordon
with/without monads ext
George Millo
@georgemillo
oh wait, I answered my own question by looking in the Rakefile