Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 23 22:22
    patrickclery edited #362
  • Oct 23 22:21
    patrickclery commented #361
  • Oct 23 22:11
    patrickclery commented #361
  • Oct 23 22:11
    patrickclery commented #361
  • Oct 23 15:43
    FioFiyo starred dry-rb/dry-types
  • Oct 23 11:52
    flash-gordon commented #361
  • Oct 23 07:09
    unixc3t starred dry-rb/dry-types
  • Oct 22 22:33
    patrickclery commented #361
  • Oct 22 21:12
    D1mon starred dry-rb/dry-matcher
  • Oct 22 15:44
    graudeejs starred dry-rb/dry-container
  • Oct 22 08:41
    esparta commented #366
  • Oct 22 08:39
    flash-gordon commented #366
  • Oct 22 08:39

    flash-gordon on master

    Fix error on Dry::Types::Array#… Merge pull request #366 from es… (compare)

  • Oct 22 08:39
    flash-gordon closed #366
  • Oct 22 08:38
    flash-gordon closed #362
  • Oct 22 08:38
    flash-gordon commented #362
  • Oct 22 08:37
    flash-gordon closed #361
  • Oct 22 08:37
    flash-gordon commented #361
  • Oct 22 07:48

    solnic on master

    Adding missing built-in predica… Merge pull request #65 from esp… Merge branch 'release-1.0' (compare)

  • Oct 22 07:47

    solnic on release-1.0

    Adding missing built-in predica… Merge pull request #65 from esp… (compare)

Piotr Solnica
@solnic
but I gotta say just using Dry::Validation.Form|JSON should work too, something to improve…
Simon Schmid
@sled
@solnic, yes I'm building a service object, and this can be fed from either form input or an API call (JSON)
so I'm basically injecting the input processor from the outside :)
stigchristian
@stigchristian
thanks @iBublik
Simon Schmid
@sled
I'm using dry-types + dry-validation as replacement for virtus to model JSON documents, is it overkill to both use dry-type and dry-validation?
I'm feeling like I'm writting a lot of things twice
e.g an Address type + a Schema for the address
Andy Holland
@AMHOL
@sled personally I think there's value in keeping coercion/type-safety logic separate from validation logic, having said that, Dry::Validation::Schema::JSON landed in dry-validation master branch recently, which uses a json input processor to infer coercions in the same way Dry::Validation::Schema::Form works
Piotr Solnica
@solnic
@sled how exactly do you use dry-types?
Simon Schmid
@sled
mh basically what our app does is porting paper forms to "digital" forms
so I want to use dry-types to describe the structure of these forms/documents
I just got confused whether I should use Types::Form::Int, Types::Coercible::Int in my document type definition
because the validation also does some coercion right?
Piotr Solnica
@solnic
no, you should not. your ‘models’ should not do any coercions
Simon Schmid
@sled
okay so I keep the models "pure and strict" types
Piotr Solnica
@solnic
yes, that’s the intention of structs in dry-types
should be as simple as possible
Simon Schmid
@sled
got it, thanks a lot! :)
Piotr Solnica
@solnic
JSON schemas are available in latest release btw
Simon Schmid
@sled
another dumb question why isn't there a Types::Maybe::Int ?
I see Types::Maybe::Strict::Int and Types::Maybe::Coercible::Int in the docs
Piotr Solnica
@solnic
because reasons :laughing:
I honestly don’t know, I probably didn’t have a use case for them yet so I didn’t add them
Simon Schmid
@sled
ah so Types::Int.optional would be equivalent to Types::Maybe::Int ?
Piotr Solnica
@solnic
btw Types::Int.optional would do it
yes
Simon Schmid
@sled
cool! :)
Piotr Solnica
@solnic
it’s basically Types::Strict::Nil | Types::Int
Simon Schmid
@sled
I'm really enjoying the dry-rb repository :)
Piotr Solnica
@solnic
awesome :)
Simon Schmid
@sled
have you ever tried to mixin schemas? :)
Like class House < Dry::Types::Struct; include Addressable; .... end
Piotr Solnica
@solnic
nope, I don’t use mixins in structs at all
Simon Schmid
@sled
how do you handle commonly repeating subsets of fields then? :)
Piotr Solnica
@solnic
class inheritance
Simon Schmid
@sled
are incomplete types possible e.g if I set some attributes as optional with a default, do I have to pass the key in the initializer e.g ModelType.new({optional_field: nil}) vs ModelType.new
Piotr Solnica
@solnic
@sled it’s being discussed how structs should work wrt optional attrs dry-rb/dry-types#72
currently you need constructor_type(:schema) to be set for optional types with default values to be set when sth is missing
Simon Schmid
@sled
thx! now I just have to bend rails to re-load my types correctly :D
Piotr Solnica
@solnic
@sled see dry-types-rails
Simon Schmid
@sled
yes but this seems broken
just read the conversation here in gitter
Piotr Solnica
@solnic
ah damn
Simon Schmid
@sled
yep, not the first time rails breaks my balls ;)
I think the issue is the "registry" of the container is not re-loaded properly
Piotr Solnica
@solnic
could be it
I don’t use rails at the moment so I’m not looking into it
Simon Schmid
@sled
sure I'm trying to fix it on my own
after reloading it tells me Dry::Container::Error: There is already an item registered with the key "customer.types.address"
Andy Holland
@AMHOL
@sled can you post your dry-types related code in a gist?