ruby-grape / grape-swagger

Add OAPI/swagger v2.0 compliant documentation to your grape API
MIT License
1.09k stars 471 forks source link

No way to specify a 'body' parameter for a PUT request #369

Open wellsmuker opened 8 years ago

wellsmuker commented 8 years ago
def is_primitive?(type)
  %w(object integer long float double string byte boolean date dateTime).include? type
end

def is_primitive?(type)
  %w(object integer long float double string byte boolean date dateTime File).include? type
end
LeFnord commented 8 years ago

sorry, don't understand … what should be the issue?

how to set the param_type, one could see here: api_swagger_v2_param_type_spec.rb

and yeap, body could be set, but it works not correct yet

wellsmuker commented 8 years ago

I used 'gem 'grape-entity', '~> 0.4.8' && gem 'grape-swagger', '~> 0.10.4'' in my Gemfile and setup

      desc 'Retrieve Authentication Token'
      params do
        requires :img_file, type: File, desc: 'photo of member'
      end

in my api.rb but it show me like this: snapshot2

if I fix doc_methods.rb #328 like this:

def is_primitive?(type) %w(object integer long float double string byte boolean date dateTime File).include? type end

I fix my problem; snapshot3

LeFnord commented 8 years ago

yeap, this is the correct behavior for file upload, please add a spec and make a PR, this change is very welcome