Add custom headers to all apis in swagger doc
Open
Nobody has claimed this yet.
feature request
- Dominant language
- Ruby
- Stars
- 10k
- Forks
- 1.2k
- Avg merge
- 14h 38m
- Merged PRs (30d)
- 92
Description
there is a way to add headers field in one api as document mentions, like below
class API::V1::Teachers < Grape::API
resource :teachers do
desc "get all teachers information" do
headers XAuthToken: {
description: 'Validates your identity',
required: true
},
XOptionalHeader: {
description: 'Not really needed',
required: false
}
end
success: API::V1::Entities::Teachers::Base
get '' do
teachers = Teacher.all
present :teachers, teachers, with: API::V1::Entities::Teachers::Base
end
end
end
but is there a way to add same headers to all apis under certain resources or namespace or all of them?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing headers option in the desc block and the API::V1::Teachers resource example. Investigate whether headers can be applied at the resource, namespace, or API scope; done means establishing a supported approach and documenting or implementing the selected scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100