1
0
Fork 0

Fix legacy swagger

This commit is contained in:
Alan Plum 2016-01-27 15:05:23 +01:00
parent 4f2dc536ee
commit b8d082941a
No known key found for this signature in database
GPG Key ID: 8ED72A9A323B6EFD
2 changed files with 4 additions and 4 deletions

View File

@ -130,7 +130,7 @@ exports.routeApp = function (service, throwOnErrors) {
return {
exports: service.main.exports,
routes: service.routes,
docs: service.docs
docs: service.legacy ? null : service.docs
};
}
@ -170,7 +170,6 @@ exports.routeApp = function (service, throwOnErrors) {
if (service.manifest.main) {
try {
service.main.exports = service.run(service.manifest.main);
// TODO mount routes
} catch (e) {
console.errorLines(`Cannot execute Foxx service at ${service.mount}: ${e.stack}`);
error = e;
@ -187,7 +186,8 @@ exports.routeApp = function (service, throwOnErrors) {
return {
exports: service.main.exports,
routes: error ? createBrokenServiceRoute(service, error) : service.routes
routes: error ? createBrokenServiceRoute(service, error) : service.routes,
docs: service.legacy ? null : service.docs
};
};

View File

@ -114,7 +114,7 @@ function swaggerJson(req, res, opts) {
}
let docs = foxx.docs;
if (!docs) {
var app = foxx.routes.foxxContext && foxx.routes.foxxContext.app;
var app = foxx.routes.foxxContext && foxx.routes.foxxContext.service;
var swagger = parseRoutes(opts.appPath, foxx.routes.routes, foxx.routes.models);
docs = {
swagger: '2.0',