ruby-grape / ruby-grape/grape-swagger

File type param uses wrong name in both docs UI and when sending test request from docs.

Open
#331 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question swagger-1.2
Dominant language
Ruby
Stars
1.1k
Forks
479
Avg merge
2d 14h
Merged PRs (30d)
6

Description

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:

screenshot_07_01_2016_19_58

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the requires_pdf_data endpoint in the generated Swagger docs with its data multipart file parameter, then compare the parameter name shown in the docs UI with the name sent in the test request. Done means the docs UI and generated request send the correct name and the endpoint no longer reports the file parameter as missing.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.