declared(params) - "no implicit conversion of Symbol into Integer" when receiving blank array
Open
Nobody has claimed this yet.
bug?
- Dominant language
- Ruby
- Stars
- 10k
- Forks
- 1.2k
- Avg merge
- 14h 38m
- Merged PRs (30d)
- 92
Description
- I have an optional array parameter. In some cases I want it to be blank, but if the items are passed, they must match the schema inside.
params do
optional :outline, type: Array do
requires :x
requires :y
end
end
- I do a PATCH request and send
{"outline": []}payload. - Received
params =>{ "outline"=>[""]} - here is the first question - why an empty string inside an array? I have a feeling that I've struggled with that a few years back, but don't remember what was the cause. declared(params)raisesno implicit conversion of Symbol into Integer
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the PATCH request with the declared optional array schema and an empty outline payload, then trace the declared(params) handling that produces the empty string and Symbol-to-Integer error. Done means the empty array is handled without the exception and the expected behavior for items inside the array is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100