grape-swagger
grape-swagger copied to clipboard
File type param uses wrong name in both docs UI and when sending test request from docs.
Grape swagger is working brilliantly for all my endpoints apart from this one that requires a File param. The grape api endpoint works fine and all params validate when I call the api from my own code but the auto generated swagger docs are not working right with this one param. Here's the param validation code:
params :requires_pdf_data do
requires :data, type: Rack::Multipart::UploadedFile, desc: 'Mulitpart file upload accepts application/pdf'
end
And here's a screenshot of how swagger shows that param:

When I call the endpoint from my own code it works perfectly but from swagger it always says that the data param is missing. Is this a bug or am I missing something? Any ideas?
Is there code in grape-swagger or swagger-ui that is wrongly labelling the param "body" when it's called "data" in the param validation?
I would compare the HTTP requests next.
@dblock Hi. Yeah, tried that and the "body" param doesn't even feature in the POST params sent when you click the "try it out!" button. So not only is the "data" param being wrongly named it is also not being sent in the POST form data.
I have the same issue. Did someone fixed it?
I'm not sure, if it is relevant to swagger-1.2, but in 2.0 for file uploads the param_type must be formData, the type must be file and consumes must be either multipart/form-data or application/x-www-form-urlencoded, maybe setting this would fix it …
It works. Thanks.