added x-swagger-router-controller, operationId for node.js versions

This commit is contained in:
Tony Tam
2016-02-05 17:12:40 -08:00
parent 161301fda7
commit eb9cff7c48
2 changed files with 34 additions and 15 deletions

View File

@@ -5,15 +5,14 @@
exports.{{nickname}} = function(args, res, next) {
/**
* parameters expected in the args:
{{#allParams}}* {{paramName}} ({{dataType}})
{{/allParams}}**/
var examples = {};
{{#examples}}
examples['{{contentType}}'] = {{{example}}};
{{/examples}}
{{#allParams}}* {{paramName}} ({{dataType}})
{{/allParams}}**/
{{^returnType}}// no response value expected for this operation
{{/returnType}}
{{#returnType}}
var examples = {};
{{#examples}}examples['{{contentType}}'] = {{{example}}};
{{/examples}}
if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@@ -24,5 +23,6 @@ var examples = {};
{{/returnType}}
{{^returnType}}res.end();{{/returnType}}
}
{{/operation}}
{{/operations}}