ruby-grape / ruby-grape/grape-swagger

Documentation says default format is :json, but it responds differently when it's explicitly specified

Open
#343 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When I have this:
add_swagger_documentation api_version: 'v1', mount_path: '/api_docs'
$ curl url/api_docs
I get a ruby hash string.
$ curl url/api_docs.json
I get a json document

add_swagger_documentation api_version: 'v1', mount_path: '/api_docs', format: :json
$ curl url/api_docs
I get a json document
$ curl url/api_docs.json
I get 404

The documentation claims that the first should be identical to the second (that is the meaning of a default).

And of course, the documentation claims the response format will be json by default, but I got a ruby hash in a string.

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

Reproduce the two curl cases for add_swagger_documentation with and without format: :json, then trace the add_swagger_documentation entry point that handles format and mount_path. Compare the observed routes and response formats with the documentation; done means the documented default behavior and both endpoint responses agree.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.