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

Generate enum property if values key is passed in documentation #8

Merged
merged 2 commits into from
Jul 29, 2016

Conversation

Lordnibbler
Copy link
Contributor

grape-entity raises an error if values: key is passed outside of the documentation hash:

expose :thing2,  values: [1, 2, 3], documentation: { type: Integer }
# => gems/grape-entity-0.5.1/lib/grape_entity/entity.rb:539:in `block in valid_options': :values is not a valid option. (ArgumentError)

However, grape-swagger-entity has business logic requiring the values: key to be passed like the above example.

This PR changes the business logic to expect the values: key inside the documentation: hash as such:

expose :thing2, documentation: { type: Integer, values: [1, 2, 3] }

@Lordnibbler
Copy link
Contributor Author

@Bugagazavr @dmitry for review, please!

@dmitry
Copy link
Contributor

dmitry commented Jul 29, 2016

I think it's ok like that. Could be merged in my opinion.

@kzaitsev
Copy link
Collaborator

@Lordnibbler Thanks, please rebase and add some information to CHANGELOG.md

@Lordnibbler
Copy link
Contributor Author

@Bugagazavr @dmitry done

@kzaitsev kzaitsev merged commit c3edc82 into ruby-grape:master Jul 29, 2016
@kzaitsev
Copy link
Collaborator

Thanks

@@ -6,7 +6,7 @@

#### Fixes

* Your contribution here.
Copy link
Member

Choose a reason for hiding this comment

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

This should be put back :)

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.

4 participants