Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 11:05
    FunkyloverOne starred dry-rb/dry-monads
  • 06:22
    zlei1 starred dry-rb/dry-web
  • Nov 18 00:58
    dteoh starred dry-rb/dry-types
  • Nov 17 21:02
    flash-gordon commented #374
  • Nov 17 21:01

    flash-gordon on master

    Update custom_ci.yml Merge pull request #374 from sk… (compare)

  • Nov 17 21:01
    flash-gordon closed #374
  • Nov 17 20:59
    skryukov opened #374
  • Nov 17 16:42

    flash-gordon on use-immutable-equalizer

    (compare)

  • Nov 17 16:42

    flash-gordon on master

    Use immutable equalizer for all… Merge pull request #373 from dr… (compare)

  • Nov 17 16:42
    flash-gordon closed #373
  • Nov 17 16:38
    flash-gordon opened #373
  • Nov 17 16:38

    flash-gordon on use-immutable-equalizer

    Use immutable equalizer for all… (compare)

  • Nov 17 16:34

    flash-gordon on no-rewrap-for-structs

    (compare)

  • Nov 17 16:34

    flash-gordon on master

    Don't build constructors when c… Merge pull request #371 from dr… (compare)

  • Nov 17 16:34
    flash-gordon closed #371
  • Nov 16 11:28
    marekciupak starred dry-rb/dry-monads
  • Nov 16 07:48
    luizfonseca starred dry-rb/dry-view
  • Nov 15 18:52
    waiting-for-dev commented #114
  • Nov 15 16:06
    businessBoris starred dry-rb/dry-system
  • Nov 15 15:16
    businessBoris starred dry-rb/dry-monads
Lorenzo Arribas
@larribas
And I don't want to store extra keys I don't use for anything
That is, I want to validate that what the client is sending me is exactly what I am asking. No more, no less
Krzysztof Wawer
@wafcio
so if hash contains more keys you want to return error, right ?
Lorenzo Arribas
@larribas
yep!
that's right
Krzysztof Wawer
@wafcio
I don’t think so that it is validation part
for sure you are not able to do it by dry-validation right now
Lorenzo Arribas
@larribas
hmm ok. don't you think it would be useful?
Krzysztof Wawer
@wafcio
in some specific case it can be useful, but you can remove extra keys and save only keys which you want
of course it depend on your use case
but as alway you can fork dry-validation, write your feature and send pull-request
Lorenzo Arribas
@larribas
ok. thanks!
Piotr Solnica
@solnic
@larribas hey, it is a feature I plan to add. Right now unexpected keys are ignored but there will be feature to treat unexpected keys as a rule violation
Lorenzo Arribas
@larribas
@solnic Good to know, thanks!

I'm curious to know what do you think of another feature (that promises to be more challenging). I have a tree of nodes (represented as a hash). Each node has some validation constraints, and a "children" key which is an array of descendants.

Currently, I am validating each node separately and traversing the tree via a recursive function, but do you think it would be fitting if one could define a recursive validation right from the schema? Or perhaps it is too awkward?

Piotr Solnica
@solnic
@larribas I want dry-v to support even awkward use cases as that is one of the reasons why it was created
Could you provide a gist presenting your usecase?
Lorenzo Arribas
@larribas
Piotr Solnica
@solnic
@larribas one thing I plan to add is to be able to treat a schema as a rule
so, theoretically you’d be able to apply schema recursively
this would be an interesting use case
it would also help in re-using schemas
Lorenzo Arribas
@larribas
reusing schemas would be a great addition
but even so, referencing the same schema from inside of it may require some kind of lazy evaluation or delayed const_get-ish thing, right?
Piotr Solnica
@solnic
@larribas nah, it would just require some additional interface to specify “validate with self"
as in apply all rules from self
API ideas most welcome :)
Andy Holland
@AMHOL
I always love self
:p
Lorenzo Arribas
@larribas
:P
Piotr Solnica
@solnic
@wafcio so, what kind of issues did you have with dry-v?
Krzysztof Wawer
@wafcio

so my opinion about dry-validation - it has freaky error format: sometime I see

errors = schema.call(email: 'jane@doe.org', age: 17).messages

puts errors.inspect
# { :age => [["age must be greater than 18"], 17] }

another time I see

errors = schema.call(email: nil, age: 19).messages

puts errors.inspect
# { :email => [["email must be filled", nil]] }

I caused that I droped dry-validation today.

Piotr Solnica
@solnic
wow what happened with the formating here?
Krzysztof Wawer
@wafcio
I have always problem with formatting in this strange style and strange new line keys
maybe I will back to dry-validation when I will have more time
Piotr Solnica
@solnic
I’m not sure what the problem is, it gives you errors
Krzysztof Wawer
@wafcio
I wanted use drop validation in API where I need return validation keys
and when I saw
[[„invalid”, nil]]
I said WHAT ???
invalid was my translation message
Piotr Solnica
@solnic
so what’s the problem?
first array includes compiled error messages, the second argument is the original input value
Krzysztof Wawer
@wafcio
and for this I must write own wrapper, and when I open README and saw that sometimes there is construction like
[[…, …], …]
I said not today
Piotr Solnica
@solnic
what is your desired format?
error messages can be compiled to anything, I just used a simple hash for now as the default but it can be literally anything, it’s a pluggable “behavior” in dry-v
Krzysztof Wawer
@wafcio
{ attribute: [error, error], attribute: [error, error]}
like it was in 0.1.0 version