Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 22 22:09

    solnic on v0.14.1

    (compare)

  • Jan 22 22:09

    solnic on master

    Bump dry-system to 0.14.1 (compare)

  • Jan 22 22:07

    solnic on master

    Use Kernel.require explicitly … (compare)

  • Jan 22 22:06

    solnic on use-kernel-require

    Use Kernel.require explicitly … (compare)

  • Jan 22 22:04

    dry-bot on master

    [devtools] update changelog.yml… [devtools] sync configs (compare)

  • Jan 22 22:04

    solnic on use-kernel-require

    (compare)

  • Jan 22 22:03

    solnic on master

    Use Kernel.require to avoid iss… Merge pull request #136 from dr… (compare)

  • Jan 22 22:03
    solnic closed #136
  • Jan 22 22:00
    solnic opened #136
  • Jan 22 21:59

    solnic on use-kernel-require

    Use Kernel.require to avoid iss… (compare)

  • Jan 21 13:13

    solnic on v0.14.0

    (compare)

  • Jan 21 13:10

    dry-bot on master

    [devtools] sync configs (compare)

  • Jan 21 13:09

    solnic on master

    Bump dry-system to 0.14.0 (compare)

  • Jan 21 13:08

    solnic on master

    Update changelog.yml (compare)

  • Jan 21 10:31

    solnic on docsite-0.15

    (compare)

  • Jan 21 10:31

    solnic on docsite-1.0

    (compare)

  • Jan 21 10:17
    Travis dry-rb/dry-view (master) errored (706)
  • Jan 21 10:14
    jchapron starred dry-rb/dry-types
  • Jan 21 10:13

    dry-bot on master

    [devtools] sync configs (compare)

  • Jan 21 10:13

    dry-bot on master

    [devtools] sync configs (compare)

Spencer Goh
@dymaxionuk
70% of the time it returns my intended value object ... I can track it down but might be nice to have a trace feature. Any other use cases other people have across like this? Do you just add a ton of hand crafted logging manually?
Maybe option trace_transaction, true
Gustavo Caso
@GustavoCaso
I'm not a very experience dry-validations user but I wanted to share a question regarding some bahaviour I found for error messages
Having this schema
BusyPeriods = Dry::Validation.Schema do
  each do
    schema do
      required(:start_date).filled(:date?)
      required(:end_date).filled(:date?)
      required(:utilisation).filled(:int?)

      rule(started_before_ended: [:start_date, :end_date]) do |start_date, end_date|
        end_date.gt?(value(:start_date))
      end
    end
  end
end
If I try to validate some data if the error is related with the required attributes I will get a message with the format { index => error_message } but if the error comes from the rule I will get just the error with out the index. Is that expected?
{0=>{:utilisation=>["must be an integer"]}}
{:started_before_ended=>["must be greater than 2018-03-21"]}
Piotr Solnica
@solnic
@GustavoCaso end_date.gt?(start_date)
Gustavo Caso
@GustavoCaso
Thanks @solnic
Christian Meier
@mkristian
hi, found some in the issue of dry-validation how to reuse a Schema for nested arrays. wanted to extend the documentation a bit, is it to make a PR against: https://github.com/dry-rb/dry-rb.org ?
looks like autogenerated somehow !
Aaron Barthel
@abrthel
@mkristian from that link, then follow this folder path source > gems > dry-validation From there you just have to edit the markdown files
Christian Meier
@mkristian
ok - thanks. and I leave gz file as is ?
Aaron Barthel
@abrthel
under docs? Yeah you dont need to alter them at all. The markdown files get rendered into the actual deployable site.
Nicolas Cavigneaux
@Bounga
Hi there. I'm playing with Dry Types and I'm wondering if it is possible to do something like Types::Strict::String.constrained(filled: true) ?
Gustavo Caso
@GustavoCaso
Absolutely you can
Nicolas Cavigneaux
@Bounga
Is this the right syntax ?
Gustavo Caso
@GustavoCaso
Yes
Nicolas Cavigneaux
@Bounga
Seems like it doesn't work in my example code
Gustavo Caso
@GustavoCaso
Types::Strict::String.constrained(filled: true).('')
Dry::Types::ConstraintError: "" violates constraints (filled?("") failed)
Types::Strict::String.constrained(filled: true).(nil)
Dry::Types::ConstraintError: nil violates constraints (type?(String, nil) AND filled?(nil) failed)
Nicolas Cavigneaux
@Bounga
oh I should have said this before but I use it through Hanami, so I have attribute :ref, Types::Strict::Int.constrained(filled: true)
Gustavo Caso
@GustavoCaso
Types::Strict::String.constrained(filled: true).('helllo')
=> "helllo"
Could you provide the version is using?
Nicolas Cavigneaux
@Bounga
0.12.2
Gustavo Caso
@GustavoCaso
What error do you see? I guess is possible to do in master
Nicolas Cavigneaux
@Bounga
I don't have any error, it just doesn't constrain the attribute to be filled
User.new(uid: 1, email: "foo", role: "admin").ref
=> nil
Gustavo Caso
@GustavoCaso
I'm not an expert in Hanami, but let me see if I can help
Nicolas Cavigneaux
@Bounga
irb(main):011:0> class Testing < Hanami::Entity
irb(main):012:1> attributes do
irb(main):013:2* attribute :ref, Types::Strict::Int.constrained(filled: true)
irb(main):014:2> end
irb(main):015:1> end
=> true
irb(main):016:0> Testing.new.ref
=> nil
oh
irb(main):017:0> Testing.new(ref: nil)
TypeError: nil (NilClass) has invalid type for :ref violates constraints (type?(Integer, nil) AND filled?(nil) failed)
Gustavo Caso
@GustavoCaso
If you remove the constrained part ?
So looks like is working, just need to pass the values :smile:
Nicolas Cavigneaux
@Bounga
Yes! I'd hope to have a way to tell "this attribute must be present"
I can do this through a custom initialize method though
Gustavo Caso
@GustavoCaso
present == filled ?
Nicolas Cavigneaux
@Bounga
not sure, official documentation only list available constrain without explaining what it does
Nicolas Cavigneaux
@Bounga
Yes so if the attribute is not present there's no check, that dry-validation job which provides required keyword
Thank a lot for your help
Gustavo Caso
@GustavoCaso
Yes I think Hanami use dry-validations right?
Nicolas Cavigneaux
@Bounga
yes
Gustavo Caso
@GustavoCaso
Nice so you can solve the issue right ?
Nicolas Cavigneaux
@Bounga
Yes I was doing my check in the wrong place
Gustavo Caso
@GustavoCaso
:+1:
Hamza Khan-Cheema
@hamzakc
What tools are people were using for API documentation. I have used swagger::blocks before (https://github.com/fotinakis/swagger-blocks) Anyone using anything else in a dry-web app ?
Semyon Pupkov
@artofhuman

Hi, i have question about dynamic arguments in dry-v schema

I try to define schema

        CreateSchema = Dry::Validation.Form do
          configure do
            option :min_time

            def time_range
              min_time...Time.current
            end
          end

          required(:start_at).filled(:time?, included_in?: time_range)
     end

but i have the error when use this schema

CreateSchema.with(min_time: 10.minutes.ago).call(params)

Failure/Error: min_time...Time.current

ArgumentError:
  bad value for range

I think this error raised when schema compiled and option min_time at thid moment is nil. It’s right way to define schema like this with dynamic agruments?

Gustavo Caso
@GustavoCaso
I think the error comes from min...Time.current
11...Time.current
ArgumentError: bad value for range