tim-vandecasteele/grape-swagger — pull request #154 by mrmargolis (2014-10-07 04:21:02+00:00)
Title: Allow Classes for type declarations inside documentation

Grape requires types to be specified using Classes, not strings. This was problematic when using Entity.documentation to specify params restrictions while also exposing the entity as a Model to grape-swagger.

module Entities
class Game < Grape::Entity
expose :level_name, documentation: { type: String }
end
end

#in a grape endpoint
params do
requires :all, using: Entities::Game.documentation
end

Without this patch the above code causes grape-swagger to consider String distinct from 'string' when type checking for swagger output on Models. This breaks the swagger UI with "this.dataType.toLowerCase is not a function swagger"