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

multi type and documentation hash #444

Merged
merged 6 commits into from
Jun 9, 2016
Merged

multi type and documentation hash #444

merged 6 commits into from
Jun 9, 2016

Conversation

scauglog
Copy link
Contributor

@scauglog scauglog commented Jun 3, 2016

multi type parameter default to first type
when :type and :default are provided in a documenation hash they override grape :type and :default

@scauglog
Copy link
Contributor Author

scauglog commented Jun 3, 2016

resolve issue #443

@@ -2,11 +2,12 @@

#### Features

* Your contribution here.
* when a parameter as multi types the first type is use as the documentation type
Copy link
Member

@LeFnord LeFnord Jun 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please could adept it to the normal changelog format, thanks

@LeFnord
Copy link
Member

LeFnord commented Jun 3, 2016

👍 … thanks, good work, please run bundle exec rake, so you see the rubocop hints 😉

@scauglog
Copy link
Contributor Author

scauglog commented Jun 3, 2016

sorry

@LeFnord
Copy link
Member

LeFnord commented Jun 7, 2016

@scauglog please adept the travis file, this feature is only available for grape >= 0.14.0

romain.sagean added 5 commits June 9, 2016 11:05
when :type and :default are provided in a documenation hash they override grape :type and :default
@scauglog
Copy link
Contributor Author

scauglog commented Jun 9, 2016

I run the multi type test only if Grape::VERSION >= '0.14'. Is that good ?

@LeFnord
Copy link
Member

LeFnord commented Jun 9, 2016

@scauglog … nice solution ≥ and if a user tries to uses types but has only grape 0.13.0, then it raises an error, right?
I'm fine with it …

@scauglog
Copy link
Contributor Author

scauglog commented Jun 9, 2016

yes, grape will raise an unknown validator: types. The same error that make the test fail for grape 0.13 and 0.12. The problem was that before grape 0.14 you can't use types when defining a parameter. I do some research and before grape 0.14 you can use type with an array of type but grape will take the first element of the array to check type (and I set the swagger type to the first element of the array).

so now I test type: [String, Integer] for all grape version and types: [String, Integer] if grape >= 0.14. All case I can think are tested if you see anything else tell me.

@LeFnord
Copy link
Member

LeFnord commented Jun 9, 2016

@scauglog … thanks 👍

@LeFnord LeFnord merged commit 6ef800c into ruby-grape:master Jun 9, 2016
LeFnord pushed a commit to LeFnord/grape-swagger that referenced this pull request Feb 9, 2019
* multi type parameter default to first type
when :type and :default are provided in a documenation hash they override grape :type and :default

* rubocop style

* changelog style

* test multi type only if grape >= 0.14

* rubocop style

* test for muli type with grape<0.14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants