-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Missing optional Array params default to the Hash instead of Array #892
Comments
This is an interesting one. I think it's a legit bug. Would love at least a spec that reproduces it. |
@dblock - I opened a PR w/ two specs for Arrays and Hashes. I wonder if the required params inside optional groups issue (#723) is related. |
There are two different issues here. The first,
so the second one, @adamcooper take a look :) |
@dm1try - Thanks for the response. I just included the first I wrote the specs to possibly simplify the implementation. The issue is the default value (with I updated the specs in this commit to help show the issue. |
why just not
Anyway, it's definitely a bug. I see now.
Thanks, now it is better than it was and makes sense! |
@dm1try - I can't remember exactly why I used Thanks! Please let me know if I can help out. I spent some time reading through the source when I was using Grape and Grape Swagger - trying to understand how to use them together really. I'm not super familiar but would like to help out if I can. I originally ran into something like this issue #928. I also was trying to use nested |
See #994.It can be closed, I think. |
Closing, @adamcooper please confirm. |
If if declare a param as a
type: Array
with nested paramsand it is missing from the incoming params (or has a default of
nil
) then it defaults to aHash
This only occurs on the
optional
as thegroup
andrequires
both throw validation errors.There is a workaround by setting a
default: []
on theArray
param.The text was updated successfully, but these errors were encountered: