diff --git a/index.js b/index.js index 21a8e8f..a732bb8 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('remoteMethodAdded', function() { + swaggerObject = createSwaggerObject(loopbackApplication, opts); + }); + var resourcePath = opts && opts.resourcePath || 'swagger.json'; if (resourcePath[0] !== '/') resourcePath = '/' + resourcePath;