Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
George Millo
@georgemillo
I imagine that this is something to do with dry-monads not being loaded?
how do I make the tests pass?
Nikita Shilnikov
@flash-gordon
@georgemillo run with rake
George Millo
@georgemillo
aha
thanks
looks like rake runs two rspec suites
what's going on there?
Nikita Shilnikov
@flash-gordon
with/without monads ext
George Millo
@georgemillo
oh wait, I answered my own question by looking in the Rakefile
funny how that happens
Piotr Solnica
@solnic
@flash-gordon I’d like to revisit hash schema implementation in dry-types, and try to figure out a more flexible way for setting them up. This was brought up before by @Kukunin I believe, I was initially against it, but we start to see more use cases where a more flexible solution would be very useful. /cc @backus
ie now we need a symbolized hash which has strict semantics too, and we’re stuck :)
this is definitely something to figure out before 1.0.0
if we can come up with a flexible solution which is also fast, that would be awesome. Oh and the lib should still provide a bunch of common, built-in hash schema types
@apotonick I’ll let you know once I have something working with the new dry-v + dry-schema, and re rom, I reported an issue about reform/rom integration so we can discuss things there I guess
Sergey Kukunin
@Kukunin
@flash-gordon I have a crash on latest master of dry-struct. on the first attribute call.
equalizer.instance_variable_get('@keys').concat(new_schema.keys)
NoMethodError: undefined method `concat' for nil:NilClass
  /Users/kukunin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/dry-struct-fbe71e6445a8/lib/dry/struct/class_interface.rb:78:in `attributes'
  /Users/kukunin/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/dry-struct-fbe71e6445a8/lib/dry/struct/class_interface.rb:50:in `attribute'
  /Users/kukunin/Sites/matic-www/gems/shift-domain/lib/shift/domain/attachment.rb:8:in `block in <module:Domain>'
Nikita Shilnikov
@flash-gordon
@Kukunin I think you need dry-core from master, check it out
Sergey Kukunin
@Kukunin
thanks. going to try
yep. that's the reason. thanks
any plans to release dry-struct 0.2.2 with minor changes?
it seems that major changes are coming (already in master)
Nikita Shilnikov
@flash-gordon
nope, I'll release 0.3, soon. Bumping dry-core will require releasing rom as well, takes some time...
Sergey Kukunin
@Kukunin
what's about releasing dry-rb/dry-struct@bfc867e commit as 0.2.2?
and next release will be 0.3
Nikita Shilnikov
@flash-gordon
too late :) I don't have time for this
Sergey Kukunin
@Kukunin
ok. looking forward 0.3 version =)
you're doing great job, though. thanks
Nikita Shilnikov
@flash-gordon
@Kukunin it's about today/tomorrow I hope
Sergey Kukunin
@Kukunin
:+1:
Ahmad Musaffa
@musaffa
@timriley After reading your series post in Icelab's blog, I've finally come to understand dry-container and dry-auto_inject etc gems and their usecases. Before that I read the docs in dry-rb site but couldn't fully understand the concepts. Wouldn't it be better if the documentation of dry-rb website also contains a getting started guide that walks the newcomers through some storybased steps introducing new concepts on every chapter like you did in the series post of Icelab blog?
Thanks.
Tim Riley
@timriley
@musaffa yep, that’s totally the plan. I’d love for us to have a “guides” section with some more step-by-step introductions.
Glad to hear you figured this stuff out via the blog posts though :)
Piotr Rybarczyk
@Argonus
Hi all. I ma trying to make custom rule it should look like this: rule(variant_presence: [:variant_id, :sku]) do |variant_id, sku| variant_id.filled? | (sku.filled? & Spree::Variant.where(sku: value(:sku)).any?) end But i have +arel+ is not a valid predicate name error. I really cant find nothing about this in documentation.
Nikita Shilnikov
@flash-gordon
@Argonus you need to define a custom predicate for this
schema = Dry::Validation.Schema do
  configure do
    def sku_exist?(value)
      Spree::Variant.where(sku: value).limit(1).any?
    end
  end

  rule(...) do |...|
    sku.filled? & sku_exist?(value(:sku))
  end
end
like this
you can't use arbitrary ruby code in rule blocks becasuse it is evaluated before you apply it to your data
Piotr Rybarczyk
@Argonus
Thanks :) just found that. As @musaffa said, that would be great to have some guides. I really love idea of dry-rb.
Piotr Rybarczyk
@Argonus
@flash-gordon One more thing, when i try to do result.errors i have got error like this
NoMethodError: undefined method<<' for #<Hash:0x00559f085ca4c0>` there is something about rules erros which i should know
Nikita Shilnikov
@flash-gordon
Don't think so
Piotr Rybarczyk
@Argonus
I think that there is issue when you would like to use custom predicate with rule.
Nikita Shilnikov
@flash-gordon
Or I wrote a broken example :) I'm not dry-v-savvy tbf :)
I'll double-check this a bit later
Piotr Solnica
@solnic
@Argonus for arbitrary ruby code you can use validate(variant_presence: [:variant_id, :sku]) { |v,s| … }
rule blocks are evaluated in the context of the DSL, it’s a BasicObject and syntax is limited
Piotr Rybarczyk
@Argonus
@solnic thanks it's working perfectly.
Nikita Shilnikov
@flash-gordon
@Kukunin psst, looks like I successfully run dry-struct 0.3.0 in production ;)
I'll update changelogs tonight
Sergey Kukunin
@Kukunin
@flash-gordon great. I'm updating right now. Having small issue with new rom-sql and sequel deprecations
great job, anyway!