ruby-grape / ruby-grape/grape-swagger
Question: How to hide endpoint documentation for specific users
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.1k
- Forks
- 479
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 6
Description
Of course we want something different than 'standard'. :P
We want to make the API documentation different for our users, based on what scopes their applications have. So, ideally, the user logs in with their application credentials, and only see the documentation of their endpoints. However, would it be possible to hide endpoint documentation based on some checks of us?
We found that it is possible to add a lambda function the 'hidden' property, but since this is evaluated out of context I haven't found a way to use any request parameters or session variables. Is this correct? Is there any other way to do what we wanted? We found a method with a middleware that scrubs the endpoints from the returned body, but this is kind of ugly. Any other ideas perhaps? I'm stuck after a full day trying and searching. Any help would be appreciated a lot.
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
No source file or test is named. Start by tracing how the hidden property and its lambda are evaluated, then check whether request parameters or session variables are available; compare that behavior with the middleware approach described. Done means documenting a supported way to hide endpoint documentation per user scope, or confirming that this is not supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, documentation
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100