diff --git a/lib/route-helper.js b/lib/route-helper.js index 8f8c10e..0ab0d1b 100644 --- a/lib/route-helper.js +++ b/lib/route-helper.js @@ -113,6 +113,40 @@ var routeHelper = module.exports = { * See https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md#523-operation-object */ routeToAPIDoc: function routeToAPIDoc(route, classDef) { + /** + * Converts from an sl-remoting data type to a Swagger dataType. + */ + function prepareDataType(type) { + if (!type) { + return 'void'; + } + + if(Array.isArray(type)) { + return 'array'; // todo items support + } + + // TODO(schoon) - Add support for complex dataTypes, "models", etc. + switch (type) { + case 'Array': + return 'array'; + case 'Boolean': + return 'boolean'; + case 'buffer': + return 'byte'; + case 'Date': + return 'date'; + case 'number': + case 'Number': + return 'double'; + case 'Object': + return 'object'; + case 'String': + return 'string'; + } + + return type; + } + var returnDesc; // Some parameters need to be altered; eventually most of this should