Skip to content

Commit be5eae6

Browse files
committed
rebuilt sample
1 parent 03adae8 commit be5eae6

File tree

8 files changed

+308
-368
lines changed

8 files changed

+308
-368
lines changed

samples/server/petstore/nodejs/api/swagger.yaml

Lines changed: 156 additions & 168 deletions
Large diffs are not rendered by default.

samples/server/petstore/nodejs/controllers/Pet.js

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ var url = require('url');
66
var Pet = require('./PetService');
77

88

9-
module.exports.updatePet = function updatePet (req, res, next) {
10-
Pet.updatePet(req.swagger.params, res, next);
11-
};
12-
139
module.exports.addPet = function addPet (req, res, next) {
1410
Pet.addPet(req.swagger.params, res, next);
1511
};
1612

13+
module.exports.deletePet = function deletePet (req, res, next) {
14+
Pet.deletePet(req.swagger.params, res, next);
15+
};
16+
1717
module.exports.findPetsByStatus = function findPetsByStatus (req, res, next) {
1818
Pet.findPetsByStatus(req.swagger.params, res, next);
1919
};
@@ -26,22 +26,14 @@ module.exports.getPetById = function getPetById (req, res, next) {
2626
Pet.getPetById(req.swagger.params, res, next);
2727
};
2828

29-
module.exports.updatePetWithForm = function updatePetWithForm (req, res, next) {
30-
Pet.updatePetWithForm(req.swagger.params, res, next);
29+
module.exports.updatePet = function updatePet (req, res, next) {
30+
Pet.updatePet(req.swagger.params, res, next);
3131
};
3232

33-
module.exports.deletePet = function deletePet (req, res, next) {
34-
Pet.deletePet(req.swagger.params, res, next);
33+
module.exports.updatePetWithForm = function updatePetWithForm (req, res, next) {
34+
Pet.updatePetWithForm(req.swagger.params, res, next);
3535
};
3636

3737
module.exports.uploadFile = function uploadFile (req, res, next) {
3838
Pet.uploadFile(req.swagger.params, res, next);
3939
};
40-
41-
module.exports.getPetByIdWithByteArray = function getPetByIdWithByteArray (req, res, next) {
42-
Pet.getPetByIdWithByteArray(req.swagger.params, res, next);
43-
};
44-
45-
module.exports.addPetUsingByteArray = function addPetUsingByteArray (req, res, next) {
46-
Pet.addPetUsingByteArray(req.swagger.params, res, next);
47-
};
Lines changed: 48 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
11
'use strict';
22

3-
exports.updatePet = function(args, res, next) {
3+
exports.addPet = function(args, res, next) {
44
/**
55
* parameters expected in the args:
6-
* body (Pet)
7-
**/
8-
9-
var examples = {};
6+
* body (Pet)
7+
**/
8+
// no response value expected for this operation
109

11-
1210

1311
res.end();
1412
}
15-
exports.addPet = function(args, res, next) {
13+
14+
exports.deletePet = function(args, res, next) {
1615
/**
1716
* parameters expected in the args:
18-
* body (Pet)
19-
**/
20-
21-
var examples = {};
17+
* petId (Long)
18+
* apiKey (String)
19+
**/
20+
// no response value expected for this operation
2221

23-
2422

2523
res.end();
2624
}
25+
2726
exports.findPetsByStatus = function(args, res, next) {
2827
/**
2928
* parameters expected in the args:
30-
* status (List)
31-
**/
32-
33-
var examples = {};
29+
* status (List)
30+
**/
3431

32+
33+
var examples = {};
3534
examples['application/json'] = [ {
3635
"tags" : [ {
3736
"id" : 123456789,
@@ -47,8 +46,6 @@ var examples = {};
4746
"photoUrls" : [ "aeiou" ]
4847
} ];
4948

50-
51-
5249
if(Object.keys(examples).length > 0) {
5350
res.setHeader('Content-Type', 'application/json');
5451
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@@ -59,14 +56,15 @@ var examples = {};
5956

6057

6158
}
59+
6260
exports.findPetsByTags = function(args, res, next) {
6361
/**
6462
* parameters expected in the args:
65-
* tags (List)
66-
**/
67-
68-
var examples = {};
63+
* tags (List)
64+
**/
6965

66+
67+
var examples = {};
7068
examples['application/json'] = [ {
7169
"tags" : [ {
7270
"id" : 123456789,
@@ -82,8 +80,6 @@ var examples = {};
8280
"photoUrls" : [ "aeiou" ]
8381
} ];
8482

85-
86-
8783
if(Object.keys(examples).length > 0) {
8884
res.setHeader('Content-Type', 'application/json');
8985
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@@ -94,14 +90,15 @@ var examples = {};
9490

9591

9692
}
93+
9794
exports.getPetById = function(args, res, next) {
9895
/**
9996
* parameters expected in the args:
100-
* petId (Long)
101-
**/
102-
103-
var examples = {};
97+
* petId (Long)
98+
**/
10499

100+
101+
var examples = {};
105102
examples['application/json'] = {
106103
"tags" : [ {
107104
"id" : 123456789,
@@ -117,8 +114,6 @@ var examples = {};
117114
"photoUrls" : [ "aeiou" ]
118115
};
119116

120-
121-
122117
if(Object.keys(examples).length > 0) {
123118
res.setHeader('Content-Type', 'application/json');
124119
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@@ -129,58 +124,46 @@ var examples = {};
129124

130125

131126
}
132-
exports.updatePetWithForm = function(args, res, next) {
133-
/**
134-
* parameters expected in the args:
135-
* petId (String)
136-
* name (String)
137-
* status (String)
138-
**/
139127

140-
var examples = {};
141-
142-
143-
144-
res.end();
145-
}
146-
exports.deletePet = function(args, res, next) {
128+
exports.updatePet = function(args, res, next) {
147129
/**
148130
* parameters expected in the args:
149-
* petId (Long)
150-
* apiKey (String)
151-
**/
152-
153-
var examples = {};
131+
* body (Pet)
132+
**/
133+
// no response value expected for this operation
154134

155-
156135

157136
res.end();
158137
}
159-
exports.uploadFile = function(args, res, next) {
138+
139+
exports.updatePetWithForm = function(args, res, next) {
160140
/**
161141
* parameters expected in the args:
162-
* petId (Long)
163-
* additionalMetadata (String)
164-
* file (file)
165-
**/
166-
167-
var examples = {};
142+
* petId (Long)
143+
* name (String)
144+
* status (String)
145+
**/
146+
// no response value expected for this operation
168147

169-
170148

171149
res.end();
172150
}
173-
exports.getPetByIdWithByteArray = function(args, res, next) {
151+
152+
exports.uploadFile = function(args, res, next) {
174153
/**
175154
* parameters expected in the args:
176-
* petId (Long)
177-
**/
178-
179-
var examples = {};
155+
* petId (Long)
156+
* additionalMetadata (String)
157+
* file (file)
158+
**/
180159

181-
examples['application/json'] = "";
182160

183-
161+
var examples = {};
162+
examples['application/json'] = {
163+
"message" : "aeiou",
164+
"code" : 123,
165+
"type" : "aeiou"
166+
};
184167

185168
if(Object.keys(examples).length > 0) {
186169
res.setHeader('Content-Type', 'application/json');
@@ -192,15 +175,4 @@ var examples = {};
192175

193176

194177
}
195-
exports.addPetUsingByteArray = function(args, res, next) {
196-
/**
197-
* parameters expected in the args:
198-
* body (byte[])
199-
**/
200-
201-
var examples = {};
202-
203178

204-
205-
res.end();
206-
}

samples/server/petstore/nodejs/controllers/Store.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ var url = require('url');
66
var Store = require('./StoreService');
77

88

9-
module.exports.getInventory = function getInventory (req, res, next) {
10-
Store.getInventory(req.swagger.params, res, next);
9+
module.exports.deleteOrder = function deleteOrder (req, res, next) {
10+
Store.deleteOrder(req.swagger.params, res, next);
1111
};
1212

13-
module.exports.placeOrder = function placeOrder (req, res, next) {
14-
Store.placeOrder(req.swagger.params, res, next);
13+
module.exports.getInventory = function getInventory (req, res, next) {
14+
Store.getInventory(req.swagger.params, res, next);
1515
};
1616

1717
module.exports.getOrderById = function getOrderById (req, res, next) {
1818
Store.getOrderById(req.swagger.params, res, next);
1919
};
2020

21-
module.exports.deleteOrder = function deleteOrder (req, res, next) {
22-
Store.deleteOrder(req.swagger.params, res, next);
21+
module.exports.placeOrder = function placeOrder (req, res, next) {
22+
Store.placeOrder(req.swagger.params, res, next);
2323
};

0 commit comments

Comments
 (0)