fixes #1581, rebuilt server

This commit is contained in:
Tony Tam
2015-11-17 18:46:33 -08:00
parent 195359008a
commit c7e5c305a9
18 changed files with 969 additions and 1252 deletions

View File

@@ -7,118 +7,33 @@ var Pet = require('./PetService');
module.exports.updatePet = function updatePet (req, res, next) {
var body = req.swagger.params['body'].value;
var result = Pet.updatePet(body);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
Pet.updatePet(req.swagger.params, res, next);
};
module.exports.addPet = function addPet (req, res, next) {
var body = req.swagger.params['body'].value;
var result = Pet.addPet(body);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
Pet.addPet(req.swagger.params, res, next);
};
module.exports.findPetsByStatus = function findPetsByStatus (req, res, next) {
var status = req.swagger.params['status'].value;
var result = Pet.findPetsByStatus(status);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
Pet.findPetsByStatus(req.swagger.params, res, next);
};
module.exports.findPetsByTags = function findPetsByTags (req, res, next) {
var tags = req.swagger.params['tags'].value;
var result = Pet.findPetsByTags(tags);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
Pet.findPetsByTags(req.swagger.params, res, next);
};
module.exports.getPetById = function getPetById (req, res, next) {
var petId = req.swagger.params['petId'].value;
var result = Pet.getPetById(petId);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
Pet.getPetById(req.swagger.params, res, next);
};
module.exports.updatePetWithForm = function updatePetWithForm (req, res, next) {
var petId = req.swagger.params['petId'].value;
var name = req.swagger.params['name'].value;
var status = req.swagger.params['status'].value;
var result = Pet.updatePetWithForm(petId, name, status);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
Pet.updatePetWithForm(req.swagger.params, res, next);
};
module.exports.deletePet = function deletePet (req, res, next) {
var petId = req.swagger.params['petId'].value;
var apiKey = req.swagger.params['api_key'].value;
var result = Pet.deletePet(petId, apiKey);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
Pet.deletePet(req.swagger.params, res, next);
};
module.exports.uploadFile = function uploadFile (req, res, next) {
var petId = req.swagger.params['petId'].value;
var additionalMetadata = req.swagger.params['additionalMetadata'].value;
var file = req.swagger.params['file'].value;
var result = Pet.uploadFile(petId, additionalMetadata, file);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
Pet.uploadFile(req.swagger.params, res, next);
};

View File

@@ -1,22 +1,36 @@
'use strict';
exports.updatePet = function(body) {
exports.updatePet = function(args, res, next) {
/**
* parameters expected in the args:
* body (Pet)
**/
var examples = {};
var examples = {};
res.end();
}
exports.addPet = function(body) {
exports.addPet = function(args, res, next) {
/**
* parameters expected in the args:
* body (Pet)
**/
var examples = {};
var examples = {};
res.end();
}
exports.findPetsByStatus = function(status) {
exports.findPetsByStatus = function(args, res, next) {
/**
* parameters expected in the args:
* status (List)
**/
var examples = {};
var examples = {};
examples['application/json'] = [ {
"tags" : [ {
@@ -35,13 +49,23 @@ exports.findPetsByStatus = function(status) {
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
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();
}
}
exports.findPetsByTags = function(tags) {
exports.findPetsByTags = function(args, res, next) {
/**
* parameters expected in the args:
* tags (List)
**/
var examples = {};
var examples = {};
examples['application/json'] = [ {
"tags" : [ {
@@ -60,13 +84,23 @@ exports.findPetsByTags = function(tags) {
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
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();
}
}
exports.getPetById = function(petId) {
exports.getPetById = function(args, res, next) {
/**
* parameters expected in the args:
* petId (Long)
**/
var examples = {};
var examples = {};
examples['application/json'] = {
"tags" : [ {
@@ -85,28 +119,54 @@ exports.getPetById = function(petId) {
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
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();
}
}
exports.updatePetWithForm = function(petId, name, status) {
exports.updatePetWithForm = function(args, res, next) {
/**
* parameters expected in the args:
* petId (String)
* name (String)
* status (String)
**/
var examples = {};
var examples = {};
res.end();
}
exports.deletePet = function(petId, apiKey) {
exports.deletePet = function(args, res, next) {
/**
* parameters expected in the args:
* petId (Long)
* apiKey (String)
**/
var examples = {};
var examples = {};
res.end();
}
exports.uploadFile = function(petId, additionalMetadata, file) {
exports.uploadFile = function(args, res, next) {
/**
* parameters expected in the args:
* petId (Long)
* additionalMetadata (String)
* file (file)
**/
var examples = {};
var examples = {};
res.end();
}

View File

@@ -7,56 +7,17 @@ var Store = require('./StoreService');
module.exports.getInventory = function getInventory (req, res, next) {
var result = Store.getInventory();
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
Store.getInventory(req.swagger.params, res, next);
};
module.exports.placeOrder = function placeOrder (req, res, next) {
var body = req.swagger.params['body'].value;
var result = Store.placeOrder(body);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
Store.placeOrder(req.swagger.params, res, next);
};
module.exports.getOrderById = function getOrderById (req, res, next) {
var orderId = req.swagger.params['orderId'].value;
var result = Store.getOrderById(orderId);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
Store.getOrderById(req.swagger.params, res, next);
};
module.exports.deleteOrder = function deleteOrder (req, res, next) {
var orderId = req.swagger.params['orderId'].value;
var result = Store.deleteOrder(orderId);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
Store.deleteOrder(req.swagger.params, res, next);
};

View File

@@ -1,8 +1,11 @@
'use strict';
exports.getInventory = function() {
exports.getInventory = function(args, res, next) {
/**
* parameters expected in the args:
**/
var examples = {};
var examples = {};
examples['application/json'] = {
"key" : 123
@@ -10,13 +13,23 @@ exports.getInventory = function() {
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
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();
}
}
exports.placeOrder = function(body) {
exports.placeOrder = function(args, res, next) {
/**
* parameters expected in the args:
* body (Order)
**/
var examples = {};
var examples = {};
examples['application/json'] = {
"id" : 123456789,
@@ -24,18 +37,28 @@ exports.placeOrder = function(body) {
"complete" : true,
"status" : "aeiou",
"quantity" : 123,
"shipDate" : "2015-10-20T06:12:23.907+0000"
"shipDate" : "2015-11-18T02:43:54.540+0000"
};
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
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();
}
}
exports.getOrderById = function(orderId) {
exports.getOrderById = function(args, res, next) {
/**
* parameters expected in the args:
* orderId (String)
**/
var examples = {};
var examples = {};
examples['application/json'] = {
"id" : 123456789,
@@ -43,19 +66,30 @@ exports.getOrderById = function(orderId) {
"complete" : true,
"status" : "aeiou",
"quantity" : 123,
"shipDate" : "2015-10-20T06:12:23.911+0000"
"shipDate" : "2015-11-18T02:43:54.544+0000"
};
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
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();
}
}
exports.deleteOrder = function(orderId) {
exports.deleteOrder = function(args, res, next) {
/**
* parameters expected in the args:
* orderId (String)
**/
var examples = {};
var examples = {};
res.end();
}

View File

@@ -7,114 +7,33 @@ var User = require('./UserService');
module.exports.createUser = function createUser (req, res, next) {
var body = req.swagger.params['body'].value;
var result = User.createUser(body);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
User.createUser(req.swagger.params, res, next);
};
module.exports.createUsersWithArrayInput = function createUsersWithArrayInput (req, res, next) {
var body = req.swagger.params['body'].value;
var result = User.createUsersWithArrayInput(body);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
User.createUsersWithArrayInput(req.swagger.params, res, next);
};
module.exports.createUsersWithListInput = function createUsersWithListInput (req, res, next) {
var body = req.swagger.params['body'].value;
var result = User.createUsersWithListInput(body);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
User.createUsersWithListInput(req.swagger.params, res, next);
};
module.exports.loginUser = function loginUser (req, res, next) {
var username = req.swagger.params['username'].value;
var password = req.swagger.params['password'].value;
var result = User.loginUser(username, password);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
User.loginUser(req.swagger.params, res, next);
};
module.exports.logoutUser = function logoutUser (req, res, next) {
var result = User.logoutUser();
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
User.logoutUser(req.swagger.params, res, next);
};
module.exports.getUserByName = function getUserByName (req, res, next) {
var username = req.swagger.params['username'].value;
var result = User.getUserByName(username);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
User.getUserByName(req.swagger.params, res, next);
};
module.exports.updateUser = function updateUser (req, res, next) {
var username = req.swagger.params['username'].value;
var body = req.swagger.params['body'].value;
var result = User.updateUser(username, body);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
User.updateUser(req.swagger.params, res, next);
};
module.exports.deleteUser = function deleteUser (req, res, next) {
var username = req.swagger.params['username'].value;
var result = User.deleteUser(username);
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
else
res.end();
User.deleteUser(req.swagger.params, res, next);
};

View File

@@ -1,48 +1,82 @@
'use strict';
exports.createUser = function(body) {
exports.createUser = function(args, res, next) {
/**
* parameters expected in the args:
* body (User)
**/
var examples = {};
var examples = {};
res.end();
}
exports.createUsersWithArrayInput = function(body) {
exports.createUsersWithArrayInput = function(args, res, next) {
/**
* parameters expected in the args:
* body (List)
**/
var examples = {};
var examples = {};
res.end();
}
exports.createUsersWithListInput = function(body) {
exports.createUsersWithListInput = function(args, res, next) {
/**
* parameters expected in the args:
* body (List)
**/
var examples = {};
var examples = {};
res.end();
}
exports.loginUser = function(username, password) {
exports.loginUser = function(args, res, next) {
/**
* parameters expected in the args:
* username (String)
* password (String)
**/
var examples = {};
var examples = {};
examples['application/json'] = "aeiou";
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
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();
}
}
exports.logoutUser = function() {
exports.logoutUser = function(args, res, next) {
/**
* parameters expected in the args:
**/
var examples = {};
var examples = {};
res.end();
}
exports.getUserByName = function(username) {
exports.getUserByName = function(args, res, next) {
/**
* parameters expected in the args:
* username (String)
**/
var examples = {};
var examples = {};
examples['application/json'] = {
"id" : 1,
@@ -57,21 +91,38 @@ exports.getUserByName = function(username) {
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
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();
}
}
exports.updateUser = function(username, body) {
exports.updateUser = function(args, res, next) {
/**
* parameters expected in the args:
* username (String)
* body (User)
**/
var examples = {};
var examples = {};
res.end();
}
exports.deleteUser = function(username) {
exports.deleteUser = function(args, res, next) {
/**
* parameters expected in the args:
* username (String)
**/
var examples = {};
var examples = {};
res.end();
}