Skip to content
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

Fix declared_params regression with multiple allowed types #2116

Conversation

stanhu
Copy link
Contributor

@stanhu stanhu commented Oct 9, 2020

Prior to Grape v1.5.0 and #2103, the following
would return nil:

params do
  optional :status_code, types: [Integer, String]
end
get '/' do
  declared_params
end

However, now it turns an empty Array.

We restore the previous behavior by not returning an empty Array if multiple
types are used.

Closes #2115

Prior to Grape v1.5.0 and ruby-grape#2103, the following
would return `nil`:

```
params do
  optional :status_code, types: [Integer, String]
end
get '/' do
  declared_params
end
```

However, now it turns an empty `Array`.

We restore the previous behavior by not returning an empty `Array` if multiple
types are used.

Closes ruby-grape#2115
@stanhu stanhu force-pushed the sh-fix-regression-declared-params-multiple-allowed-types branch from 47c3b4d to 44217dd Compare October 9, 2020 17:00
@dblock
Copy link
Member

dblock commented Oct 9, 2020

i'm merging but i don't want to look at the string comparison ;)

@dblock dblock merged commit 0e0c155 into ruby-grape:master Oct 9, 2020
@dblock
Copy link
Member

dblock commented Oct 9, 2020

check out #2112, does this fix that? can we get those spec changes here?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

declared_params regression in 1.5.0 with multiple allowed types
2 participants