Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 22 22:09

    solnic on v0.14.1

    (compare)

  • Jan 22 22:09

    solnic on master

    Bump dry-system to 0.14.1 (compare)

  • Jan 22 22:07

    solnic on master

    Use Kernel.require explicitly … (compare)

  • Jan 22 22:06

    solnic on use-kernel-require

    Use Kernel.require explicitly … (compare)

  • Jan 22 22:04

    dry-bot on master

    [devtools] update changelog.yml… [devtools] sync configs (compare)

  • Jan 22 22:04

    solnic on use-kernel-require

    (compare)

  • Jan 22 22:03

    solnic on master

    Use Kernel.require to avoid iss… Merge pull request #136 from dr… (compare)

  • Jan 22 22:03
    solnic closed #136
  • Jan 22 22:00
    solnic opened #136
  • Jan 22 21:59

    solnic on use-kernel-require

    Use Kernel.require to avoid iss… (compare)

  • Jan 21 13:13

    solnic on v0.14.0

    (compare)

  • Jan 21 13:10

    dry-bot on master

    [devtools] sync configs (compare)

  • Jan 21 13:09

    solnic on master

    Bump dry-system to 0.14.0 (compare)

  • Jan 21 13:08

    solnic on master

    Update changelog.yml (compare)

  • Jan 21 10:31

    solnic on docsite-0.15

    (compare)

  • Jan 21 10:31

    solnic on docsite-1.0

    (compare)

  • Jan 21 10:17
    Travis dry-rb/dry-view (master) errored (706)
  • Jan 21 10:14
    jchapron starred dry-rb/dry-types
  • Jan 21 10:13

    dry-bot on master

    [devtools] sync configs (compare)

  • Jan 21 10:13

    dry-bot on master

    [devtools] sync configs (compare)

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
Andy Holland
@AMHOL
@solnic @timriley yeah I did experiment with a stateless routing tree router, it was a failed experiment
Pablo Herrero
@pabloh
Hey guys, how can you do introspection on a dry-validation schema?
Piotr Solnica
@solnic
[11] pry(main)> Dry::Validation.Schema { required(:name).filled }.class.rule_ast
=> [[:rule, [:name, [:and, [[:rule, [:name, [:predicate, [:key?, [[:name, :name], [:input, Undefined]]]]]], [:rule, [:name, [:key, [:name, [:predicate, [:filled?, [[:input, Undefined]]]]]]]]]]]]]
@pabloh ie like this ^