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

Message generator chokes on processing disjunction #26

Closed
flash-gordon opened this issue Feb 7, 2019 · 1 comment
Closed

Message generator chokes on processing disjunction #26

flash-gordon opened this issue Feb 7, 2019 · 1 comment
Assignees
Labels
bug hints issues related to hints feature
Milestone

Comments

@flash-gordon
Copy link
Member

Taken from dry-rb/dry-validation#280

(Dry::Schema.define { required(:foo) { str? & filled? | int? } }).call({}).messages

Traceback (most recent call last):
        17: from ./bin/console:40:in `<main>'
        16: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/result.rb:117:in `messages'
        15: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/result.rb:142:in `message_set'
        14: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:45:in `call'
        13: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:45:in `map'
        12: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:45:in `block in call'
        11: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:50:in `visit'
        10: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:79:in `visit_and'
         9: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:79:in `map'
         8: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:79:in `block in visit_and'
         7: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:50:in `visit'
         6: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:62:in `visit_hint'
         5: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:50:in `visit'
         4: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:137:in `visit_key'
         3: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:50:in `visit'
         2: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:93:in `visit_or'
         1: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:93:in `new'
@flash-gordon
Copy link
Member Author

This is another one

schema = Dry::Schema.define do
  required(:attributes).schema do
    optional(:text) { int? | nil? }
  end
end

schema.({}).messages

         9: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/result.rb:117:in `messages'
         8: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/result.rb:142:in `message_set'
         7: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_compiler.rb:45:in `call'
         6: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_set.rb:22:in `[]'
         5: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_set.rb:22:in `new'
         4: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_set.rb:34:in `initialize'
         3: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_set.rb:107:in `initialize_placeholders!'
         2: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_set.rb:107:in `reduce'
         1: from /Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_set.rb:107:in `each'
/Users/gordon/dev/dry-rb/dry-schema/lib/dry/schema/message_set.rb:114:in `block in initialize_placeholders!': no implicit conversion of Symbol into Integer (TypeError)

@solnic solnic added this to the 1.0.0 milestone Feb 16, 2019
@solnic solnic self-assigned this Feb 19, 2019
@solnic solnic added the hints issues related to hints feature label Feb 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug hints issues related to hints feature
Projects
None yet
Development

No branches or pull requests

2 participants