-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
field using types turned into array when declared(params) #2112
base: master
Are you sure you want to change the base?
Conversation
Here's an example of a CHANGELOG.md entry: * [#2112](https://github.com/ruby-grape/grape/pull/2112): Field using type turned into array when declared(params) - [@braktar](https://github.com/braktar). Generated by 🚫 danger |
what was the behavior in 1.3.x, 1.4.x? either way looks like a bug, another one... /cc: @tlconnor |
Related #2103 |
Before the integration of #2103 the spec passed successfully |
Here is a fix which avoid the misinterpretation of the type |
That's strange that the type of empty_typed_arr turned from Array[String] to [String] when arrived into |
Let's extend tests with |
if type == 'Hash' && !has_children | ||
{} | ||
elsif type == 'Array' || type&.start_with?('[') | ||
elsif type == 'Array' || type && type.start_with?('[') && !type.include?(',') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right @dblock that working with Strings here is not ideal. I don't know enough to know if there is a better alternative.
I don't really see what should exhibit these tests, as the only ambiguity is between It seems to require a deeper investigation |
I mean what happens if |
@stanhu isn't this the same? |
Yes, it's the same. I just picked the commit in #2117. |
It seems that the recent works on declared change the interaction between 'declared' and the 'types' field