Changed Swagger() to omit resources with no content

This commit is contained in:
Shelby Sanders 2015-02-07 22:58:30 -08:00
parent 3ca1f45a77
commit 5902425f52
1 changed files with 11 additions and 1 deletions

View File

@ -45,7 +45,17 @@ function Swagger(loopbackApplication, swaggerApp, opts) {
// A class is an endpoint root; e.g. /users, /products, and so on.
classes.forEach(function (aClass) {
var doc = apiDocs[aClass.name] = classHelper.generateAPIDoc(aClass, opts);
resourceDoc.apis.push(classHelper.generateResourceDocAPIEntry(aClass));
var hasPublic = false;
var methods = aClass.methods()
for (var methodKey in methods) {
hasPublic = methods[methodKey].public;
if (hasPublic) {
break;
}
}
if (hasPublic) {
resourceDoc.apis.push(classHelper.generateResourceDocAPIEntry(aClass));
}
// Add the getter for this doc.
var docPath = urlJoin(opts.resourcePath, aClass.http.path);