ruby-grape / ruby-grape/grape-swagger
Document root namespace
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.1k
- Forks
- 479
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 6
Description
Hi,
For my endpoints, I wrap my response in a data namespace (using root keyword) in a similar way as shown in the example below.
The problem is that it seems that there is not a way to document that behavior using desc.success or failure.
Is there any way to tell grape-swagger that I want my success model under a data root without adding that namespace in the entity itself?
Thanks,
Miguel.
resource 'cats' do
desc 'Get a list of cats.' do
success model: API::V1::Entities::Cat
end
get '/' do
# some code to get @cat
present @cat, with: API::V1::Entities::Cat, root: :data
end
end
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
Review how grape-swagger handles models passed through desc.success or failure, and how Grape's root: :data option affects the response. Determine where the documented success schema is generated and verify that the resulting Swagger schema represents the data namespace without requiring it in the entity.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, documentation
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100