forked from loafle/openapi-generator-original
29 lines
710 B
Plaintext
29 lines
710 B
Plaintext
'use strict';
|
|
|
|
{{#operations}}
|
|
{{#operation}}
|
|
exports.{{nickname}} = function(args, res, next) {
|
|
/**
|
|
* parameters expected in the args:
|
|
{{#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));
|
|
}
|
|
else {
|
|
res.end();
|
|
}
|
|
{{/returnType}}
|
|
{{^returnType}}res.end();{{/returnType}}
|
|
}
|
|
|
|
{{/operation}}
|
|
{{/operations}}
|