-
Notifications
You must be signed in to change notification settings - Fork 63
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
Exclude remote services #191
Comments
Well there is also the possibility to ignore by tags. The tag for a service can be set via docs property. Another possibility would be to register the services you don't want to have in swagger before the use of feathers-swagger initialization. |
I've tried that, but it also requires me to check if |
So I tested it not with feathers-distributed directly, but with a service that has a property remote set to true. Service with remote set to true. const seqtestService = new Seqtest(options, app);
seqtestService.remote = true;
app.use('/seqtest', seqtestService); Adding a mixin that sets the internal tag for services with the remote property. app.configure((app) => {
app.mixins.push((service) => {
if (service.remote === true) {
service.docs = {
tag: 'internal',
};
}
});
});
app.configure(swagger({
specs: {
info: {
title: 'Testing stuff with feathers',
version: '0.0.1',
},
},
openApiVersion: 3,
uiIndex: true,
ignore: {
tags: ['internal'],
},
//...
})); And this worked out for me. And tags that are not used by any added service, like the internal tag in that case, should not be added to the spec at all. |
But for a future version, an additional function based option to ignore services can be added for sure. |
Cool, setting Thanks a lot for your help! |
When working with remote services using the feathers-distributed lib, the
addService
method in feathers-swagger gets called for each service, local or remote.I want to exclude all the remote services from swagger. in order to do so, I've tried using the include/ignore options, but I don't have any services path list.
I've tried to add a similar
addService
method to the mixin, right before feathers-swaggeraddService
method, and collect paths to include/ignore, but the include/ignore array is cloned in feathers-swagger when the library is initialized.I've ended up replacing feathers-swagger
addService
mixin method with a proxy method that calls feathers-swaggeraddService
method only for local services, whenservice.remote
is false or undefined.Is there any better way to do this?
The text was updated successfully, but these errors were encountered: