grape-swagger icon indicating copy to clipboard operation
grape-swagger copied to clipboard

Question: How to hide endpoint documentation for specific users

Open marktermaat opened this issue 9 years ago • 2 comments

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.

marktermaat avatar Mar 23 '16 09:03 marktermaat

This is correct, however I think we'd welcome a feature that evaluates the endpoint condition based on the request.

dblock avatar Mar 25 '16 12:03 dblock

Just got merged https://github.com/ruby-grape/grape-swagger/pull/493

texpert avatar Sep 08 '16 15:09 texpert