Commit f366c8d
authored
Fix missing nested param error for nested array params (#1085)
* Remove unreachable code
`Lucky::Params#nested_arrays?` returns a hash, which is truthy.
* Simplify calls
`Lucky::Params#nested_file?` returns a hash always, although its
signature says it returns a nilable hash.
* Fix error with nested arrays
Even if nested params is not empty, Lucky would still raise
`Lucky::MissingNestedParamError` if any array attributes are empty.
You had to fill in the array attribute to avoid the error:
```
response = client.exec(Features::Create, feature: {
choices: Array(String).new, # Without this, you get "Missing param key: 'feature' (Lucky::MissingNestedParamError)..."
maximum: 99,
minimum: 3,
name: "Number of Kitchens",
type: :integer
})
```1 parent c1827c6 commit f366c8d
2 files changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
0 commit comments