dry-rb / dry-rb/dry-initializer
Incorrect processing of nil value for array with nested structure
Open
bug
help wanted
- Dominant language
- Ruby
- Stars
- 342
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
## Describe the bug
I get a `KeyError` when pass the `nil` value for option, but it's ok when the option is omitted
## To Reproduce
```ruby
class X
extend Dry::Initializer
option :fields, [], optional: true, default: proc { [] } do
option :name
end
end
X.new #=> #
X.new(fields: []) #=> #
X.new(fields: nil) #=> KeyError (X::Fields: option 'name' is required)
```
## Expected behavior
Getting and empty array
## My environment
- Ruby version: 2.7.5
- OS: Linux
- dry-initializer (3.1.1)
Contributor guide
Assessment
This issue has not been assessed yet.