dry-rb / dry-rb/dry-schema

Extension info, not work with macros `maybe`

Open
#367 3 comments 1 reaction 0 assignees View on GitHub
bug help wanted
Dominant language
Ruby
Stars
492
Forks
123
PR merge metrics
No merged PRs in 30d

Description

## Describe the bug

`UserSchema.info` raised an error if schema has `.maybe`

## To Reproduce

```ruby
UserSchema = Dry::Schema.JSON do
optional(:age).maybe(:integer)
end
UserSchema.info
```
```
undefined method `visit_not' for #
Did you mean? visit_and
visit_set
visit_key
lib/dry/schema/extensions/info/schema_compiler.rb:46:in `public_send'
lib/dry/schema/extensions/info/schema_compiler.rb:46:in `visit'
lib/dry/schema/extensions/info/schema_compiler.rb:74:in `block in visit_implication'
```

## Expected behavior

A clear and concise description of what you expected to happen.

## My environment

- Affects my production application: **YES**
- Ruby version: 2.7
- OS: linux

Contributor guide

Open the contributing guide

Research direction

Start with lib/dry/schema/extensions/info/schema_compiler.rb:46, where the reported visit_not dispatch fails, then reproduce the issue with the UserSchema.info example using optional(:age).maybe(:integer). Done means UserSchema.info completes without raising for schemas using maybe; check the existing info extension tests for the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.