add back summary and description to nodejs swagger.json

This commit is contained in:
wing328 2015-07-09 14:05:08 +08:00
parent 4143e28637
commit 1f35f58841
10 changed files with 1250 additions and 937 deletions

View File

@ -15,17 +15,17 @@
{{#operation}}
"{{{path}}}": {
"{{httpMethod}}": {
"summary": "{{summary}}",
"description":"{{notes}}",
"x-swagger-router-controller": "{{classname}}",
"tags": ["{{baseName}}"],
"operationId": "{{operationId}}",{{#hasParams}}
"parameters": [
{{#allParams}}
{{{jsonSchema}}}{{#hasMore}},{{/hasMore}}
{{#allParams}}{{{jsonSchema}}}{{#hasMore}},{{/hasMore}}
{{/allParams}}
],{{/hasParams}}
"responses": {
{{#responses}}
"{{code}}": {{{jsonSchema}}}
{{#responses}}"{{code}}": {{{jsonSchema}}}
{{#hasMore}},{{/hasMore}}
{{/responses}}
}

File diff suppressed because it is too large Load Diff

View File

@ -6,13 +6,13 @@ var url = require('url');
var Pet = require('./PetService');
module.exports.updatePet = function updatePet(req, res, next) {
module.exports.updatePet = function updatePet (req, res, next) {
var body = req.swagger.params['body'].value;
var result = Pet.updatePet(body);
if (typeof result !== 'undefined') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -20,13 +20,13 @@ module.exports.updatePet = function updatePet(req, res, next) {
res.end();
};
module.exports.addPet = function addPet(req, 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') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -34,13 +34,13 @@ module.exports.addPet = function addPet(req, res, next) {
res.end();
};
module.exports.findPetsByStatus = function findPetsByStatus(req, 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') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -48,13 +48,13 @@ module.exports.findPetsByStatus = function findPetsByStatus(req, res, next) {
res.end();
};
module.exports.findPetsByTags = function findPetsByTags(req, 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') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -62,13 +62,13 @@ module.exports.findPetsByTags = function findPetsByTags(req, res, next) {
res.end();
};
module.exports.getPetById = function getPetById(req, 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') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -76,7 +76,7 @@ module.exports.getPetById = function getPetById(req, res, next) {
res.end();
};
module.exports.updatePetWithForm = function updatePetWithForm(req, 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;
@ -84,7 +84,7 @@ module.exports.updatePetWithForm = function updatePetWithForm(req, res, next) {
var result = Pet.updatePetWithForm(petId, name, status);
if (typeof result !== 'undefined') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -92,14 +92,14 @@ module.exports.updatePetWithForm = function updatePetWithForm(req, res, next) {
res.end();
};
module.exports.deletePet = function deletePet(req, res, next) {
var api_key = req.swagger.params['api_key'].value;
module.exports.deletePet = function deletePet (req, res, next) {
var apiKey = req.swagger.params['api_key'].value;
var petId = req.swagger.params['petId'].value;
var result = Pet.deletePet(api_key, petId);
var result = Pet.deletePet(apiKey, petId);
if (typeof result !== 'undefined') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -107,7 +107,7 @@ module.exports.deletePet = function deletePet(req, res, next) {
res.end();
};
module.exports.uploadFile = function uploadFile(req, 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;
@ -115,7 +115,7 @@ module.exports.uploadFile = function uploadFile(req, res, next) {
var result = Pet.uploadFile(petId, additionalMetadata, file);
if (typeof result !== 'undefined') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}

View File

@ -1,104 +1,112 @@
'use strict';
exports.updatePet = function (body) {
exports.updatePet = function(body) {
var examples = {};
}
exports.addPet = function (body) {
exports.addPet = function(body) {
var examples = {};
}
exports.findPetsByStatus = function (status) {
exports.findPetsByStatus = function(status) {
var examples = {};
examples['application/json'] = [{
"tags": [{
"id": 123456789,
"name": "aeiou"
}],
"id": 123456789,
"category": {
"id": 123456789,
"name": "aeiou"
examples['application/json'] = [ {
"tags" : [ {
"id" : 123456789,
"name" : "aeiou"
} ],
"id" : 123456789,
"category" : {
"id" : 123456789,
"name" : "aeiou"
},
"status": "aeiou",
"name": "doggie",
"photoUrls": ["aeiou"]
}];
"status" : "aeiou",
"name" : "doggie",
"photoUrls" : [ "aeiou" ]
} ];
if (Object.keys(examples).length > 0)
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
}
exports.findPetsByTags = function (tags) {
exports.findPetsByTags = function(tags) {
var examples = {};
examples['application/json'] = [{
"tags": [{
"id": 123456789,
"name": "aeiou"
}],
"id": 123456789,
"category": {
"id": 123456789,
"name": "aeiou"
examples['application/json'] = [ {
"tags" : [ {
"id" : 123456789,
"name" : "aeiou"
} ],
"id" : 123456789,
"category" : {
"id" : 123456789,
"name" : "aeiou"
},
"status": "aeiou",
"name": "doggie",
"photoUrls": ["aeiou"]
}];
"status" : "aeiou",
"name" : "doggie",
"photoUrls" : [ "aeiou" ]
} ];
if (Object.keys(examples).length > 0)
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
}
exports.getPetById = function (petId) {
exports.getPetById = function(petId) {
var examples = {};
examples['application/json'] = {
"tags": [{
"id": 123456789,
"name": "aeiou"
}],
"id": 123456789,
"category": {
"id": 123456789,
"name": "aeiou"
"tags" : [ {
"id" : 123456789,
"name" : "aeiou"
} ],
"id" : 123456789,
"category" : {
"id" : 123456789,
"name" : "aeiou"
},
"status": "aeiou",
"name": "doggie",
"photoUrls": ["aeiou"]
};
"status" : "aeiou",
"name" : "doggie",
"photoUrls" : [ "aeiou" ]
};
if (Object.keys(examples).length > 0)
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
}
exports.updatePetWithForm = function (petId, name, status) {
exports.updatePetWithForm = function(petId, name, status) {
var examples = {};
}
exports.deletePet = function (api_key, petId) {
exports.deletePet = function(apiKey, petId) {
var examples = {};
}
exports.uploadFile = function (petId, additionalMetadata, file) {
exports.uploadFile = function(petId, additionalMetadata, file) {
var examples = {};
}

View File

@ -6,12 +6,12 @@ var url = require('url');
var Store = require('./StoreService');
module.exports.getInventory = function getInventory(req, res, next) {
module.exports.getInventory = function getInventory (req, res, next) {
var result = Store.getInventory();
if (typeof result !== 'undefined') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -19,13 +19,13 @@ module.exports.getInventory = function getInventory(req, res, next) {
res.end();
};
module.exports.placeOrder = function placeOrder(req, 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') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -33,13 +33,13 @@ module.exports.placeOrder = function placeOrder(req, res, next) {
res.end();
};
module.exports.getOrderById = function getOrderById(req, 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') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -47,13 +47,13 @@ module.exports.getOrderById = function getOrderById(req, res, next) {
res.end();
};
module.exports.deleteOrder = function deleteOrder(req, 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') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}

View File

@ -1,57 +1,61 @@
'use strict';
exports.getInventory = function () {
exports.getInventory = function() {
var examples = {};
examples['application/json'] = {
"key": 123
};
"key" : 123
};
if (Object.keys(examples).length > 0)
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
}
exports.placeOrder = function (body) {
exports.placeOrder = function(body) {
var examples = {};
examples['application/json'] = {
"id": 123456789,
"petId": 123456789,
"complete": true,
"status": "aeiou",
"quantity": 123,
"shipDate": "2015-03-19T21:51:51.599+0000"
};
"id" : 123456789,
"petId" : 123456789,
"complete" : true,
"status" : "aeiou",
"quantity" : 123,
"shipDate" : "2015-07-09T06:03:19.571+0000"
};
if (Object.keys(examples).length > 0)
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
}
exports.getOrderById = function (orderId) {
exports.getOrderById = function(orderId) {
var examples = {};
examples['application/json'] = {
"id": 123456789,
"petId": 123456789,
"complete": true,
"status": "aeiou",
"quantity": 123,
"shipDate": "2015-03-19T21:51:51.603+0000"
};
"id" : 123456789,
"petId" : 123456789,
"complete" : true,
"status" : "aeiou",
"quantity" : 123,
"shipDate" : "2015-07-09T06:03:19.576+0000"
};
if (Object.keys(examples).length > 0)
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
}
exports.deleteOrder = function (orderId) {
exports.deleteOrder = function(orderId) {
var examples = {};
}

View File

@ -6,13 +6,13 @@ var url = require('url');
var User = require('./UserService');
module.exports.createUser = function createUser(req, res, next) {
module.exports.createUser = function createUser (req, res, next) {
var body = req.swagger.params['body'].value;
var result = User.createUser(body);
if (typeof result !== 'undefined') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -20,13 +20,13 @@ module.exports.createUser = function createUser(req, res, next) {
res.end();
};
module.exports.createUsersWithArrayInput = function createUsersWithArrayInput(req, 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') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -34,13 +34,13 @@ module.exports.createUsersWithArrayInput = function createUsersWithArrayInput(re
res.end();
};
module.exports.createUsersWithListInput = function createUsersWithListInput(req, 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') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -48,14 +48,14 @@ module.exports.createUsersWithListInput = function createUsersWithListInput(req,
res.end();
};
module.exports.loginUser = function loginUser(req, 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') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -63,12 +63,12 @@ module.exports.loginUser = function loginUser(req, res, next) {
res.end();
};
module.exports.logoutUser = function logoutUser(req, res, next) {
module.exports.logoutUser = function logoutUser (req, res, next) {
var result = User.logoutUser();
if (typeof result !== 'undefined') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -76,13 +76,13 @@ module.exports.logoutUser = function logoutUser(req, res, next) {
res.end();
};
module.exports.getUserByName = function getUserByName(req, 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') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -90,14 +90,14 @@ module.exports.getUserByName = function getUserByName(req, res, next) {
res.end();
};
module.exports.updateUser = function updateUser(req, 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') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}
@ -105,13 +105,13 @@ module.exports.updateUser = function updateUser(req, res, next) {
res.end();
};
module.exports.deleteUser = function deleteUser(req, 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') {
if(typeof result !== 'undefined') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(result || {}, null, 2));
}

View File

@ -1,69 +1,77 @@
'use strict';
exports.createUser = function (body) {
exports.createUser = function(body) {
var examples = {};
}
exports.createUsersWithArrayInput = function (body) {
exports.createUsersWithArrayInput = function(body) {
var examples = {};
}
exports.createUsersWithListInput = function (body) {
exports.createUsersWithListInput = function(body) {
var examples = {};
}
exports.loginUser = function (username, password) {
exports.loginUser = function(username, password) {
var examples = {};
examples['application/json'] = "aeiou";
if (Object.keys(examples).length > 0)
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
}
exports.logoutUser = function () {
exports.logoutUser = function() {
var examples = {};
}
exports.getUserByName = function (username) {
exports.getUserByName = function(username) {
var examples = {};
examples['application/json'] = {
"id": 123456789,
"lastName": "aeiou",
"phone": "aeiou",
"username": "aeiou",
"email": "aeiou",
"userStatus": 123,
"firstName": "aeiou",
"password": "aeiou"
};
"id" : 1,
"username" : "johnp",
"firstName" : "John",
"lastName" : "Public",
"email" : "johnp@swagger.io",
"password" : "-secret-",
"phone" : "0123456789",
"userStatus" : 0
};
if (Object.keys(examples).length > 0)
if(Object.keys(examples).length > 0)
return examples[Object.keys(examples)[0]];
}
exports.updateUser = function (username, body) {
exports.updateUser = function(username, body) {
var examples = {};
}
exports.deleteUser = function (username) {
exports.deleteUser = function(username) {
var examples = {};
}

View File

@ -1,7 +1,7 @@
{
"name": "",
"version": "",
"description": "This is a sample server Petstore server. You can find out more about Swagger at <a href="http://swagger.io">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key "special-key" to test the authorization filters",
"version": "1.0.0",
"description": "This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters",
"main": "index.js",
"keywords": [
"swagger"