tim-vandecasteele/grape-swagger — pull request #132 by Antek-drzewiecki (2014-07-30 12:04:08+00:00)
Title: Addes support for enum values in entity documentation and form parameters

Grape supports has a value restrictions trough arrays or Proc. Swagger UI supports form parameter restrictions trough the enum field. You can also document an entity enum values with the enum field in Swagger UI. This push request adds parameter value integration between Grape (Entity) and Swagger UI.

Usage:

``` ruby
class Status < Grape::Entity
expose :text, documentation: { type: 'string', desc: 'Status update text.' }
expose :links, using: Link, documentation: { type: 'link', is_array: true }
expose :numbers, documentation: { type: 'integer', desc: 'favourite number', values: [1,2,3,4] }
end

desc 'Creates a new status', entity: API::Entities::Status, params: API::Entities::Status.documentation
post '/statuses' do
...
end

desc 'Creates a new status', entity: API::Entities::Status
params do
required :numbers , type: Integer, values:[1,2,3]
...
end
post '/statuses' do
...
end
```