Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 12 21:34
    flash-gordon commented #376
  • Dec 12 21:34
    flash-gordon labeled #376
  • Dec 12 21:34
    flash-gordon opened #376
  • Dec 12 19:32
    RyanLafferty starred dry-rb/dry-types
  • Dec 12 05:53
    technofreak starred dry-rb/dry-monads
  • Dec 12 00:14
    thekuwayama starred dry-rb/dry-monads
  • Dec 11 09:29
    blasterun starred dry-rb/dry-monads
  • Dec 11 08:34
    flash-gordon closed #115
  • Dec 11 08:34
    flash-gordon commented #115
  • Dec 11 08:31

    flash-gordon on v1.3.3

    (compare)

  • Dec 11 08:30

    flash-gordon on master

    Bump version to 1.3.3 (compare)

  • Dec 11 08:30

    flash-gordon on master

    Update CHANGELOG (compare)

  • Dec 10 23:46
    johnmaxwell commented #116
  • Dec 10 21:54

    flash-gordon on master

    Halt with mutable backtrace Ex… Merge pull request #116 from jo… (compare)

  • Dec 10 21:54
    flash-gordon closed #116
  • Dec 10 21:54
    flash-gordon commented #116
  • Dec 10 21:49
    johnmaxwell commented #116
  • Dec 10 21:47
    johnmaxwell commented #116
  • Dec 10 21:43
    johnmaxwell commented #116
  • Dec 10 21:39
    johnmaxwell commented #116
John Backus
@backus
Nice ^ Sounds like a big improvement
Don Morrison
@elskwid
Agreed. I like the divide.
Piotr Solnica
@solnic
I should mention that “schema” will be an abstract concept in dry-validation
so any object implementing required interface will work
Tim Riley
@timriley
Oh good, I was going to ask about whether a validation class would require a local schema definition, or whether you could pass one in.
In fact, in a system where your schemas are on the edge, would you need to pass it to the validation object at all, given you know you've already passed your data through it?
Piotr Solnica
@solnic
@timriley yes because a schema defines the input structure so we can easily extract specific values for other rules
a validator needs to know what it’s dealing with
so ie you’d be able to define an HTTP schema at the boundary, and use it in a validator by connecting the two
but you won’t have to define it in the validator itself
I would like to have a way of defining schemas for every http endpoint somehow
we can also do this the other way around, define plain schemas in validators, and infer http schemas from them for http end-points
Tim Riley
@timriley
Right
I like the of comprehensive endpoint scheme definition
The idea of*
Piotr Solnica
@solnic
r.get(“search”) do |r|
  r.schema do
    optional(:q).filled(:str?)
  end

  r.view(‘users.index’, params: { q: s[:q] })
end
maybe this is doable for roda ^
this can define schemas on the fly (and cache them) and then expose s (or something) to access processed params
it can register these schemas in the container and then you could just do:
class UserSearchValidator < Dry::Validation::Validator
  include Import(schema: “schemas.users.search”)

  rule(:q) { |q| … }
end
not the best example but you should see the idea regardless
the beauty of this approach is that http stuff doesn’t leak into domain land
@timriley ^^
we can easily add a shortcut in dry-web ie class UserSearchValidator < Dry::Validation[“schemas.users.search”]
Piotr Solnica
@solnic
I’m hoping that if we make this really easy, folks will start validating http params for all end-points, this should make apps more secure and crash less
I also love the fact it can self-document end-points
we can easily add additional APIs for annotating schemas with docs, and generate API docs from that, all kinds of nice things are possible
Tim Riley
@timriley
Yeah, this looks promising!
Piotr Solnica
@solnic
yeah :) I think this will be it :)
I honestly can’t wait to start working on this, dry-v has been in the backround of my brain for many months, but I didn’t have time to work on it because of rom 3.0
Tim Riley
@timriley
Yay :)
Not sure how r.schema could register items in the container though, since the container gets frozen and the routing block isn’t evaluated until each request comes in.
that’s one problem with dynamic routes like roda's
Piotr Solnica
@solnic
you mean, another problem? O_o
Tim Riley
@timriley
HEH.
Piotr Solnica
@solnic
well, we may need a special schema registry that we can import into app’s container
and that one won’t be frozen
I don’t think roda apps are deeply frozen
so it should work
Tim Riley
@timriley
yeah...
and eventually we design dry-router and dry-controller, right?
Piotr Solnica
@solnic
haha…NOPE although @AMHOL have experimented with this already…:D
personally I’m more interested in plugging hanami stuff into dry-web
I don’t feel like working on http routers and related things tbf, but I wouldn’t be against it if somebody really wants to do it and be serious about it
Tim Riley
@timriley
yeah
Hanami’s stuff could fit pretty nicely.
Piotr Solnica
@solnic
well it does fit, I built rodakase-lotus last year (as a PoC)
Tim Riley
@timriley
yeah, I remember… lotuskase :)
Piotr Solnica
@solnic
right, this :)
timriley @timriley adds to TODO list