ruby-grape / ruby-grape/grape-swagger
enhancemnt to "add_root" feature
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.1k
- Forks
- 479
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 6
Description
The new add_root feature is extremely nice and something I've been waiting for in this gem for a while.
One small issue with it is that the way it handles dynamically building the 'root' name is solely based on the response model class name. Where as, ideally what would be nice is to "detect" if said response model is a grape-entity class and query the "Root" configuration from that class.
I have several GrapeEntity classes that change the "root" to be someone slightly different than the internal class name (e.g. OrganizationMember -> 'members'/'member') so having the swagger gem consult the entity class. (e.g. simply calling OrganizationMember.root_element(root_type) where root_type is :collection_root or :root ).
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 at the add_root feature entry point and inspect how it derives the root from the response model class; then check whether the response model exposes root_element(root_type) for collection_root and root. Done when generated Swagger output uses the entity-configured singular and plural roots while preserving existing behavior.
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
- 35/100