These are chat archives for dry-rb/chat

22nd
Aug 2017
Opan Mustopah
@opan
Aug 22 2017 02:34
Hi, how we can validate an uploaded file with dry-validation?
Maybe something like optional(:doc_file).filled(:binary?) ?
Opan Mustopah
@opan
Aug 22 2017 02:39
Well I guess I can use this http://dry-rb.org/gems/dry-validation/custom-predicates/ to create my own validation.
siassaj
@siassaj
Aug 22 2017 06:52
foo.()
Dry::Struct::Error: [Order::GetDeliveryQuotes::DeliveryDetails.new] :reference is missing in Hash input
from /home/sia/.gem/ruby/2.3.1/gems/dry-struct-0.3.1/lib/dry/struct/class_interface.rb:94:in `rescue in new'
any way to improve the error stack trace? I've no idea what's causing this
nvm found it :D
Chris Richards
@cmrichards
Aug 22 2017 14:07
Will there be a dry-rb book with good real work examples on how to use all the gems to build a system?
Nikita Shilnikov
@flash-gordon
Aug 22 2017 14:20
@cmrichards I'm not sure but we could clone @solnic for that
Chris Richards
@cmrichards
Aug 22 2017 14:38
Permissive schemas raise errors when keys are missing? It's a strange use of the word permissive
"Permissive: Allowing or characterized by great or excessive freedom of behavior."
Nikita Shilnikov
@flash-gordon
Aug 22 2017 14:41
I guess so, that choice was made by @backus IIRC
Chris Richards
@cmrichards
Aug 22 2017 14:42
Unless I'm missing something blindingly obvious here, it makes no sense at all
Nikita Shilnikov
@flash-gordon
Aug 22 2017 14:42
:grin:
Chris Richards
@cmrichards
Aug 22 2017 14:43
Perhaps it was a simple mistake made by a non-English speaker?
Unless there is good explanation for it then it should certainly be changed
Nikita Shilnikov
@flash-gordon
Aug 22 2017 14:44
@cmrichards check this out dry-rb/dry-types#133
Chris Richards
@cmrichards
Aug 22 2017 15:18
i guess it's ok
New developers will need to learn what the different constructor types mean anyway, so I don't suppose it matters
Chris Richards
@cmrichards
Aug 22 2017 15:25

The different constructor schema types seem kind of arbitrary. An interface that allowed you to combine different behaviour types might work to?

hash = Types::Hash.symbolise.allow_nil_values.allow_ommitted_keys.allow_inavlid_type

Although it's a bit verbose

Nikita Shilnikov
@flash-gordon
Aug 22 2017 15:32
@cmrichards there are problems with this approach https://gitter.im/dry-rb/chat?at=57684aa2a82a6b0079a77c9a there is also dry-rb/dry-types#194 but we haven't discussed it yet