ruby-grape / ruby-grape/grape-swagger

params are not loading when defined both in desc block and separate params block

Open
#400 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Desc block params are not loading when defined with separate params block, e.g.

desc "Create a User.", {
        headers: {'XAuthToken': {required: true}},
        params: Entities::UserEntity.documentation
}
params do
        optional :extra_parameter, type: String
end

In above case only extra_parameter and header field are visible. This worked well previously by showing all desc block params field with separate params block field.

This code works well by displaying header field with optional extra_parameter

desc "Create a User.", {
        headers: {'XAuthToken': {required: true}},
}
params do
        optional :extra_parameter, type: String
end

but below code only shows params field and not header field (I have removed extra param block)

desc "Create a User.", {
        headers: {'XAuthToken': {required: true}},
        params: Entities::UserEntity.documentation
}

I think this is a bug. What you guys think.

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

No source file or test is named. Reproduce the issue with the two desc and params block examples, then trace how desc params and params-block fields are combined in the generated API documentation. Done means the combined case shows both the header and extra_parameter, while each isolated case retains its documented fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.