update php, nodejs, scalatra server for petstore

This commit is contained in:
wing328
2016-04-15 20:05:45 +08:00
parent 400cc9e6f9
commit c93fcc2643
23 changed files with 1197 additions and 1185 deletions

View File

@@ -33,3 +33,7 @@ module.exports.updatePet = function updatePet (req, res, next) {
module.exports.updatePetWithForm = function updatePetWithForm (req, res, next) {
Pet.updatePetWithForm(req.swagger.params, res, next);
};
module.exports.uploadFile = function uploadFile (req, res, next) {
Pet.uploadFile(req.swagger.params, res, next);
};

View File

@@ -12,8 +12,8 @@ exports.addPet = function(args, res, next) {
exports.deletePet = function(args, res, next) {
/**
* parameters expected in the args:
* apiKey (String)
* petId (Long)
* apiKey (String)
**/
// no response value expected for this operation
res.end();
@@ -121,7 +121,7 @@ exports.updatePet = function(args, res, next) {
exports.updatePetWithForm = function(args, res, next) {
/**
* parameters expected in the args:
* petId (String)
* petId (Long)
* name (String)
* status (String)
**/
@@ -129,3 +129,26 @@ exports.updatePetWithForm = function(args, res, next) {
res.end();
}
exports.uploadFile = function(args, res, next) {
/**
* parameters expected in the args:
* petId (Long)
* additionalMetadata (String)
* file (file)
**/
var examples = {};
examples['application/json'] = {
"message" : "aeiou",
"code" : 123,
"type" : "aeiou"
};
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();
}
}

View File

@@ -10,6 +10,10 @@ module.exports.deleteOrder = function deleteOrder (req, res, next) {
Store.deleteOrder(req.swagger.params, res, next);
};
module.exports.getInventory = function getInventory (req, res, next) {
Store.getInventory(req.swagger.params, res, next);
};
module.exports.getOrderById = function getOrderById (req, res, next) {
Store.getOrderById(req.swagger.params, res, next);
};

View File

@@ -9,10 +9,28 @@ exports.deleteOrder = function(args, res, next) {
res.end();
}
exports.getInventory = function(args, res, next) {
/**
* parameters expected in the args:
**/
var examples = {};
examples['application/json'] = {
"key" : 123
};
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(args, res, next) {
/**
* parameters expected in the args:
* orderId (String)
* orderId (Long)
**/
var examples = {};
examples['application/json'] = {