Skip to content

Allow Classes for type declarations inside documentation #154

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

Merged
merged 1 commit into from
Oct 7, 2014

Conversation

mrmargolis
Copy link
Contributor

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"

@dblock
Copy link
Member

dblock commented Oct 7, 2014

This makes sense. Can you please update CHANGELOG and squash these commits? Thanks.

@mrmargolis
Copy link
Contributor Author

Done. Thanks.

dblock added a commit that referenced this pull request Oct 7, 2014
Allow Classes for type declarations inside documentation
@dblock dblock merged commit 6d4bfbc into ruby-grape:master Oct 7, 2014
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