ruby-grape / ruby-grape/grape-roar
Add support for documentation fields
Open
Nobody has claimed this yet.
discuss!
new feature
- Dominant language
- Ruby
- Stars
- 59
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
Grape exposures give you entity_name, exposures and documentation. We can add those for out-of-the-box support for https://github.com/tim-vandecasteele/grape-swagger.
module Grape
module Roar
module Representer
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def entity_name
self.name.split('::').last.gsub(/Presenter$/, '')
end
def exposures
{}
end
def documentation
Hash[representable_attrs.map do |attribute|
property_name = attribute[:as].evaluate nil, nil
next if property_name == '_links'
[ property_name, { desc: attribute[:desc], type: attribute[:type] }]
end.compact]
end
end
end
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
Start at Grape::Roar::Representer::ClassMethods and compare the existing representer behavior with the proposed entity_name, exposures, and documentation entry points. Check how grape-swagger consumes these fields, then add coverage for the three fields, including the documented _links exclusion. Done means out-of-the-box grape-swagger support works for Grape exposures.
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