`dry-types 1.5.1` is broken with `dry-logic ~>1.3`
ojab opened this issue · comments
Describe the bug
I guess it could be expected (i. e. dry-types should be updated to >~ 1.6
to make it work), but for the user it's unexpected.
To Reproduce
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'dry-types', '1.5.1'
gem 'dry-logic', '~> 1.3'
end
module Types
include Dry.Types()
Email = String.constrained(format: /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i)
Age = Integer.constrained(gt: 18)
end
$ ruby /tmp/d.rb
…/gems/dry-types-1.5.1/lib/dry/types/constraints.rb:20:in `block in Rule': undefined method `build' for Dry::Logic::Rule::Predicate:Class (NoMethodError)
Logic::Rule::Predicate.build(
^^^^^^
Expected behavior
It works!
My environment
- Affects my production application: kinda? Not really, but dependabot PR for dry-types cannot pass CI because of that.
- Ruby version: 3.1.2
- OS: linux
I don't think there's much to be done beyond updating dry-types. Since dry-types depends on dry-logic, one can consider it a bug in dry-types.