fix resource listing and remove id from each property
This commit is contained in:
parent
b9df4b6706
commit
e22b826bca
|
@ -81,10 +81,6 @@ var modelHelper = module.exports = {
|
|||
required.push(key);
|
||||
}
|
||||
|
||||
if (prop.hasOwnProperty('required')){
|
||||
delete prop.required;
|
||||
}
|
||||
|
||||
// Change mismatched keys.
|
||||
prop = translateDataTypeKeys(prop);
|
||||
|
||||
|
@ -93,6 +89,9 @@ var modelHelper = module.exports = {
|
|||
delete prop.type;
|
||||
}
|
||||
|
||||
delete prop.required;
|
||||
delete prop.id;
|
||||
|
||||
// Assign this back to the properties object.
|
||||
properties[key] = prop;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ var urlJoin = require('./url-join');
|
|||
var _defaults = require('lodash.defaults');
|
||||
var classHelper = require('./class-helper');
|
||||
var routeHelper = require('./route-helper');
|
||||
var _cloneDeep = require('lodash.clonedeep');
|
||||
|
||||
/**
|
||||
* Create a remotable Swagger module for plugging into `RemoteObjects`.
|
||||
|
@ -129,11 +130,16 @@ function addRoute(app, uri, doc, opts) {
|
|||
* @return {Object} Resource doc.
|
||||
*/
|
||||
function generateResourceDoc(opts) {
|
||||
var apiInfo = _cloneDeep(opts.apiInfo);
|
||||
for (var property in apiInfo) {
|
||||
property = Array.isArray(property) ? property.join('') : property;
|
||||
}
|
||||
|
||||
return {
|
||||
swaggerVersion: opts.swaggerVersion,
|
||||
apiVersion: opts.version,
|
||||
// See https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md#513-info-object
|
||||
info: opts.apiInfo,
|
||||
info: apiInfo,
|
||||
// TODO Authorizations
|
||||
// https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md#514-authorizations-object
|
||||
consumes: ['application/json', 'application/xml', 'text/xml'],
|
||||
|
|
Loading…
Reference in New Issue