-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide endpoints based on yaml/spec #1743
Comments
Hi, this is for swagger-node to do. Can you please open a ticket in that project? For example, the swagger-inflector allows |
While it's probably best to do this in the json/yaml file, one can use this hack in index.html. Insert between // hack to filter out internal endpoints, operations and parameters before rendering
var oldSuccess = window.swaggerUi.getOption('success');
function filterInternal(x) { return x['x-hide'] !== true && (x['vendorExtensions']||{})['x-hide'] !== true; };
window.swaggerUi.setOption('success', function() {
var client = window.swaggerUi.api;
client.apisArray = client.apisArray.filter(filterInternal);
client.apisArray.forEach(function(api) {
api.operationsArray = api.operationsArray.filter(filterInternal);
api.operationsArray.forEach(function(op) {
op.parameters = op.parameters.filter(filterInternal);
});
});
return oldSuccess();
}); |
You should be able to write a plugin to the new UI to add that functionality. |
Hi,
I want to add some attribute to my yaml spec for example x-hide : true/false so that the swagger-ui will know to not show those endpoints.
i can't remove them completely from the yaml because im using swagger-node / swagger-express-mw so it's define the express mw based on this yaml, so if i remove them i can't use them at all.
i want them to be reachable but just not presented on the ui (because documentaion isn't ready yet / because they are mostly internally APIs that doesn't interest for the API users).
is there any way to do it?
maybe someone can help me to the best way to do it if there isn't out of the box?
Thanks.
The text was updated successfully, but these errors were encountered: