grape: Errors with using entity documentation

I was trying to migrate my params to using entities and I’m getting different types of errors. Is this grape-entity error or grape?

#...
      requires :all, using: Entity::Activity.documentation.except(:id)
#...
module Entity
  class Activity < Base
    expose :id, documentation: {type: 'integer', desc: 'id'}
    expose :active, documentation: {type: 'Boolean', desc: 'id'}
# ...

This is error happens first of all.

lib/grape/validations/types.rb:114:in `recognized?': undefined method `ancestors' for "string":String (NoMethodError)

This error happens when I’m changing type to classes. I get it we don’t have Boolean type in ruby and grape uses virtus, but with Integer and String type there is no errors.

`<class:Activity>': uninitialized constant Entity::Activity::Boolean (NameError)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

One more thing. This will fail if one of your parameters is type: Boolean. Based on what I read in #1144, I changed to type: Grape::API::Boolean.