diff --git a/lib/class-helper.js b/lib/class-helper.js index de3a0a7..333b5ea 100644 --- a/lib/class-helper.js +++ b/lib/class-helper.js @@ -28,6 +28,8 @@ var classHelper = module.exports = { basePath: opts.basePath, resourcePath: urlJoin('/', opts.resourcePath), apis: [], + consumes: aClass.http.consumes || opts.consumes, + produces: aClass.http.produces || opts.produces, models: modelHelper.generateModelDefinition(aClass.ctor, {}) }; }, diff --git a/lib/swagger.js b/lib/swagger.js index da4102c..d517303 100644 --- a/lib/swagger.js +++ b/lib/swagger.js @@ -7,12 +7,10 @@ module.exports = Swagger; /** * Module dependencies. */ -var debug = require('debug')('loopback:explorer:swagger'); var path = require('path'); var urlJoin = require('./url-join'); var _defaults = require('lodash.defaults'); var classHelper = require('./class-helper'); -var modelHelper = require('./model-helper'); var routeHelper = require('./route-helper'); /** @@ -28,6 +26,9 @@ function Swagger(loopbackApplication, swaggerApp, opts) { swaggerVersion: '1.2', basePath: loopbackApplication.get('restApiRoot') || '/api', resourcePath: 'resources', + // Default consumes/produces to application/json + consumes: ['application/json'], + produces: ['application/json'], version: getVersion() });