Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predicate +:<foo>?+ inferred from <bar> type spec is not supported (ArgumentError) #101

Closed
konstantin-dzreev opened this issue Mar 21, 2019 · 1 comment
Assignees
Milestone

Comments

@konstantin-dzreev
Copy link

konstantin-dzreev commented Mar 21, 2019

Hi, thanks for fixing #97, but I believe the issue is either deeper or I'm not properly using schema with custom types. Here is my example:

require 'mongo'

module Types
  include Dry::Types.module

  BSONObjectId = Definition(BSON::ObjectId)
    .constructor(->(val){ BSON::ObjectId(val) })
    .constrained(type: BSON::ObjectId)
end

Dry::Schema.Params do
  required(:template_id).filled(Types::BSONObjectId)
end

It raises a similar error:

Predicate +:objectid?+ inferred from #<Dry::Types::Constrained::Coercible type=#<Dry::Types::Constructor type=#<Dry::Types::Definition primitive=BSON::ObjectId options={} meta={}> options={:fn=>#<Proc:0x000055ad1b4f8918@/home/konstantin/source/sandbox/rom-kd/main.rb:11 (lambda)>} meta={}> options={:rule=>#<Dry::Logic::Rule::Predicate predicate=#<Method: Dry::Logic::Predicates.type?> options={:args=>[BSON::ObjectId]}>} rule=#<Dry::Logic::Rule::Predicate predicate=#<Method: Dry::Logic::Predicates.type?> options={:args=>[BSON::ObjectId]}> meta={}> type spec is not supported (ArgumentError)
@solnic
Copy link
Member

solnic commented Mar 22, 2019

oh I need to add support for custom types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants