ruby-grape / ruby-grape/grape-entity
Nested Documentation
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 729
- Forks
- 154
- PR merge metrics
- No merged PRs in 30d
Description
When using Grape, Grape Entity and Grape Swagger and I have an entity with a nested object. Should we have the ability to provide nested documentation if that object has a nested object inside?
Example.
class User < Grape::Entity
expose :id, documentation: { type: 'Integer', desc: 'Id' }
expose :firstname, documentation: { type: 'String', desc: 'First Name' }
expose :lastname, documentation: { type: 'String', desc: 'Last Name' }
expose :username, documentation: { type: 'String', desc: 'Username' }
expose :email, documentation: { type: 'String', desc: 'Email' }
expose :location, using: API::Entities::Location, as: :location
But when I call
API::Entities::User.documentation
it doesn't include my location inside the documentation hash.
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 API::Entities::User.documentation and the exposed API::Entities::Location relation, then trace how Grape::Entity builds the documentation hash for nested objects. Done means User.documentation includes the nested location documentation, including an object nested inside that location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100