timriley on v0.24.0
timriley on remove-dry-struct
github-actions[bot] on main
[devtools] sync (compare)
action-hero[bot] on main
Update dry-system.gemspec from … (compare)
flash-gordon on main
Remove dry-struct dependency I… Bump version Update CHANGELOG (compare)
Types::Strict::String.constrained(filled: true).(nil)
Dry::Types::ConstraintError: nil violates constraints (type?(String, nil) AND filled?(nil) failed)
User.new(uid: 1, email: "foo", role: "admin").ref
=> nil
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)
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?
11...Time.current
ArgumentError: bad value for range