Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 13 15:58
    rokhimin starred dry-rb/dry-matcher
  • Dec 13 08:53
    flash-gordon labeled #376
  • Dec 13 08:44
    solnic commented #376
  • 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
Piotr Solnica
@solnic
then we can explicitly define which predicates are available where
and improve UX in general
Fran Worley
@fran-worley
that's true. I'll take out the changes I made in #177 and then it can merge as its just spec updates?
Piotr Solnica
@solnic
actually that part can stay
just merge it in :)
Fran Worley
@fran-worley
Ok cool, does the error name make sense? InvalidSchemaError ?
Piotr Solnica
@solnic
yep
Fran Worley
@fran-worley
cool
Piotr Solnica
@solnic
seems like the fixes in dry-types made tons of specs pass :)
Fran Worley
@fran-worley
I got the whole lot to pass, then skipped another load which were fudged
Ralf Schmitz Bongiolo
@mrbongiolo
@solnic dry-rb/dry-validation#172 should be passing now too, I updated my app code and the array? rule seems to be working correctly
Piotr Solnica
@solnic
@mrbongiolo pls merge these specs in if they are passing now
Ralf Schmitz Bongiolo
@mrbongiolo
let me check it
Ralf Schmitz Bongiolo
@mrbongiolo
@solnic that's weird, in my app it's working, but the specs are still failing...
Piotr Solnica
@solnic
@mrbongiolo it needs dry-types from master
Ralf Schmitz Bongiolo
@mrbongiolo
@solnic shouldn't a bundle update get it from master already?
Piotr Solnica
@solnic
yeah but travis is weird with caching so…maybe remove cache and restart
Ralf Schmitz Bongiolo
@mrbongiolo
@solnic the build passed on Travis, for some reason my local build doesn't want to update dry-types or is just not using the version from master, gonna check out later what's going on
Oskar Szrajer
@gotar

Another probably stupid question ;]

require "dry-validation"

module Validations
  PostValidator = Dry::Validation.Form do
    required(:title) { filled? & str? }
    required(:body){ filled? & str? }
  end
end

if I have Validator like this how I can use it with AutoInject? There is no method new to call by it, t's just a function. I need to mark it somehow or do sth else?

Blog::Container["validations.post_validator"]
NoMethodError: undefined method `new' for #<#<Class:0x007fdbb0c8b1b0>:0x007fdbb0bf2898>
    from /Users/gotar/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/dry-component-0bebc656b625/lib/dry/component/loader.rb:42:in `instance'
Nikita Shilnikov
@flash-gordon
@gotar I know @timriley had a similar issue. I don't use dry-component atm so I don't know how to handle it properly, too high level for me :)
Oskar Szrajer
@gotar
ok I have solution
just pack class around it
require "dry-validation"

module Validations
  class PostValidator
    PostSchema = Dry::Validation.Form do
      required(:title) { filled? & str? }
      required(:body){ filled? & str? }
    end

    def call(args)
      PostSchema.call(args)
    end
  end
end
Piotr Solnica
@solnic
I don't register schemas in containers
just set them as constants
Andy Holland
@AMHOL
@gotar you can pass a block to auto_register!
And use that to determine how to construct the objects
@solnic perhaps we should have a configuration and delegate that to an object
Piotr Solnica
@solnic
better to skip auto-registering schemas
just define them as constants
that's why I added block syntax for building an object
Andy Holland
@AMHOL
How come @solnic ?
Oskar Szrajer
@gotar
it will be the best if AutoInject recognize it's class or not and then defind as contant not call new on it
Andy Holland
@AMHOL
@gotar just watching your wroc_love.rb talk BTW :)
Piotr Solnica
@solnic
link pls?
Oskar Szrajer
@gotar
nothing to see :p
:cat2:
Andy Holland
@AMHOL
lol I'm sure you're being humble
Piotr Solnica
@solnic
@AMHOL it didn't feel right to use a container for things like schemas or data classes like structs and values, they are treated as app boundaries, not some "abstract service objects" that your app relies on
Andy Holland
@AMHOL
Interesting
What about using them in dry-transaction?
Piotr Solnica
@solnic
so ie whenever I see a require "some_app/validation/some_schema" I know that this thing works at a specific boundary of my system
I never used as a schema as a separate step
Andy Holland
@AMHOL
Ahh OK
You just use them in commands?
Piotr Solnica
@solnic
it's always an object that uses a schema internally and typically talks to a db through a repo or command or sutin
Andy Holland
@AMHOL
That makes sense
Piotr Solnica
@solnic
a...service object :P
one thing I still don't like is that this still mixes an http-specific schema with a lower-level app stuff