From 68d0d37ba17dfa34bca2b41ddad2b58d13c8709e Mon Sep 17 00:00:00 2001 From: Flavien DAVID Date: Wed, 29 Mar 2017 15:42:50 +0200 Subject: [PATCH 1/2] adding on started listener to display nestRemoting method in swagger explorer --- index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.js b/index.js index 21a8e8f..8662cd1 100644 --- a/index.js +++ b/index.js @@ -122,6 +122,13 @@ function mountSwagger(loopbackApplication, swaggerApp, opts) { swaggerObject = createSwaggerObject(loopbackApplication, opts); }); + // listening to started event for updating the swaggerObject + // when a call to app.models.[modelName].nestRemoting([modelName]) + // to appear that method in the Swagger UI. + loopbackApplication.on('started', function() { + swaggerObject = createSwaggerObject(loopbackApplication, opts); + }); + var resourcePath = opts && opts.resourcePath || 'swagger.json'; if (resourcePath[0] !== '/') resourcePath = '/' + resourcePath; From d0f70cc71f2412f0d32af87f6944e82e6d18a413 Mon Sep 17 00:00:00 2001 From: Flavien DAVID Date: Wed, 29 Mar 2017 17:26:51 +0200 Subject: [PATCH 2/2] change listener from started to remoteMethodAdded --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 8662cd1..a732bb8 100644 --- a/index.js +++ b/index.js @@ -125,7 +125,7 @@ function mountSwagger(loopbackApplication, swaggerApp, opts) { // listening to started event for updating the swaggerObject // when a call to app.models.[modelName].nestRemoting([modelName]) // to appear that method in the Swagger UI. - loopbackApplication.on('started', function() { + loopbackApplication.on('remoteMethodAdded', function() { swaggerObject = createSwaggerObject(loopbackApplication, opts); });