Merge pull request #2466 from wing328/nodejs_method_name

[NodeJS] fix operationId issue with Nodejs
This commit is contained in:
wing328 2016-04-09 18:53:55 +08:00
commit 5522edac0c
9 changed files with 129 additions and 355 deletions

1
.gitignore vendored
View File

@ -43,6 +43,7 @@ samples/server-generator/scalatra/output/.history
# nodejs # nodejs
samples/server-generator/node/output/node_modules samples/server-generator/node/output/node_modules
samples/server/petstore/nodejs/node_modules samples/server/petstore/nodejs/node_modules
samples/server/petstore/nodejs-server/node_modules
# qt5 cpp # qt5 cpp
samples/client/petstore/qt5cpp/PetStore/moc_* samples/client/petstore/qt5cpp/PetStore/moc_*

View File

@ -8,7 +8,7 @@ info:
For this sample, you can use the api key `special-key` to test the authorization filters For this sample, you can use the api key `special-key` to test the authorization filters
version: "1.0.0" version: "1.0.0"
title: Swagger Petstore title: Swagger Petstore
termsOfService: http://helloreverb.com/terms/ termsOfService: http://swagger.io/terms/
contact: contact:
name: apiteam@swagger.io name: apiteam@swagger.io
license: license:

View File

@ -1,53 +1,40 @@
--- ---
swagger: "2.0" swagger: "2.0"
info: info:
description: "This is a sample server Petstore server. You can find out more about\n\ description: "This is a sample server Petstore server.\n\n[Learn about Swagger](http://swagger.io)\
Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\n\ \ or join the IRC channel `#swagger` on irc.freenode.net.\n\nFor this sample,\
For this sample, you can use the api key `special-key` to test the authorization\ \ you can use the api key `special-key` to test the authorization filters\n"
\ filters.\n"
version: "1.0.0" version: "1.0.0"
title: "Swagger Petstore" title: "Swagger Petstore"
termsOfService: "http://swagger.io/terms/" termsOfService: "http://swagger.io/terms/"
contact: contact:
email: "apiteam@swagger.io" name: "apiteam@swagger.io"
license: license:
name: "Apache 2.0" name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html" url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "petstore.swagger.io" host: "petstore.swagger.io"
basePath: "/v2" basePath: "/v2"
tags:
- name: "pet"
description: "Everything about your Pets"
externalDocs:
description: "Find out more"
url: "http://swagger.io"
- name: "store"
description: "Access to Petstore orders"
- name: "user"
description: "Operations about user"
externalDocs:
description: "Find out more about our store"
url: "http://swagger.io"
schemes: schemes:
- "http" - "http"
paths: paths:
/pet: /pets:
post: post:
tags: tags:
- "pet" - "pet"
summary: "Add a new pet to the store" summary: "Add a new pet to the store"
description: ""
operationId: "addPet" operationId: "addPet"
consumes: consumes:
- "application/json" - "application/json"
- "application/xml" - "application/xml"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- in: "body" - in: "body"
name: "body" name: "body"
description: "Pet object that needs to be added to the store" description: "Pet object that needs to be added to the store"
required: true required: false
schema: schema:
$ref: "#/definitions/Pet" $ref: "#/definitions/Pet"
responses: responses:
@ -55,25 +42,26 @@ paths:
description: "Invalid input" description: "Invalid input"
security: security:
- petstore_auth: - petstore_auth:
- "write:pets" - "write_pets"
- "read:pets" - "read_pets"
x-swagger-router-controller: "Pet" x-swagger-router-controller: "Pet"
put: put:
tags: tags:
- "pet" - "pet"
summary: "Update an existing pet" summary: "Update an existing pet"
description: ""
operationId: "updatePet" operationId: "updatePet"
consumes: consumes:
- "application/json" - "application/json"
- "application/xml" - "application/xml"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- in: "body" - in: "body"
name: "body" name: "body"
description: "Pet object that needs to be added to the store" description: "Pet object that needs to be added to the store"
required: true required: false
schema: schema:
$ref: "#/definitions/Pet" $ref: "#/definitions/Pet"
responses: responses:
@ -85,32 +73,27 @@ paths:
description: "Validation exception" description: "Validation exception"
security: security:
- petstore_auth: - petstore_auth:
- "write:pets" - "write_pets"
- "read:pets" - "read_pets"
x-swagger-router-controller: "Pet" x-swagger-router-controller: "Pet"
/pet/findByStatus: /pets/findByStatus:
get: get:
tags: tags:
- "pet" - "pet"
summary: "Finds Pets by status" summary: "Finds Pets by status"
description: "Multiple status values can be provided with comma separated strings" description: "Multiple status values can be provided with comma seperated strings"
operationId: "findPetsByStatus" operationId: "findPetsByStatus"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- name: "status" - name: "status"
in: "query" in: "query"
description: "Status values that need to be considered for filter" description: "Status values that need to be considered for filter"
required: true required: false
type: "array" type: "array"
items: items:
type: "string" type: "string"
default: "available"
enum:
- "available"
- "pending"
- "sold"
collectionFormat: "multi" collectionFormat: "multi"
responses: responses:
200: 200:
@ -123,25 +106,25 @@ paths:
description: "Invalid status value" description: "Invalid status value"
security: security:
- petstore_auth: - petstore_auth:
- "write:pets" - "write_pets"
- "read:pets" - "read_pets"
x-swagger-router-controller: "Pet" x-swagger-router-controller: "Pet"
/pet/findByTags: /pets/findByTags:
get: get:
tags: tags:
- "pet" - "pet"
summary: "Finds Pets by tags" summary: "Finds Pets by tags"
description: "Muliple tags can be provided with comma separated strings. Use\n\ description: "Muliple tags can be provided with comma seperated strings. Use\
tag1, tag2, tag3 for testing.\n" \ tag1, tag2, tag3 for testing."
operationId: "findPetsByTags" operationId: "findPetsByTags"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- name: "tags" - name: "tags"
in: "query" in: "query"
description: "Tags to filter by" description: "Tags to filter by"
required: true required: false
type: "array" type: "array"
items: items:
type: "string" type: "string"
@ -157,24 +140,24 @@ paths:
description: "Invalid tag value" description: "Invalid tag value"
security: security:
- petstore_auth: - petstore_auth:
- "write:pets" - "write_pets"
- "read:pets" - "read_pets"
deprecated: true
x-swagger-router-controller: "Pet" x-swagger-router-controller: "Pet"
/pet/{petId}: /pets/{petId}:
get: get:
tags: tags:
- "pet" - "pet"
summary: "Find pet by ID" summary: "Find pet by ID"
description: "Returns a single pet" description: "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate\
\ API error conditions"
operationId: "getPetById" operationId: "getPetById"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- name: "petId" - name: "petId"
in: "path" in: "path"
description: "ID of pet to return" description: "ID of pet that needs to be fetched"
required: true required: true
type: "integer" type: "integer"
format: "int64" format: "int64"
@ -189,55 +172,59 @@ paths:
description: "Pet not found" description: "Pet not found"
security: security:
- api_key: [] - api_key: []
- petstore_auth:
- "write_pets"
- "read_pets"
x-swagger-router-controller: "Pet" x-swagger-router-controller: "Pet"
post: post:
tags: tags:
- "pet" - "pet"
summary: "Updates a pet in the store with form data" summary: "Updates a pet in the store with form data"
description: "null" description: ""
operationId: "updatePetWithForm" operationId: "updatePetWithForm"
consumes: consumes:
- "application/x-www-form-urlencoded" - "application/x-www-form-urlencoded"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- name: "petId" - name: "petId"
in: "path" in: "path"
description: "ID of pet that needs to be updated" description: "ID of pet that needs to be updated"
required: true required: true
type: "integer" type: "string"
format: "int64"
- name: "name" - name: "name"
in: "formData" in: "formData"
description: "Updated name of the pet" description: "Updated name of the pet"
required: false required: true
type: "string" type: "string"
- name: "status" - name: "status"
in: "formData" in: "formData"
description: "Updated status of the pet" description: "Updated status of the pet"
required: false required: true
type: "string" type: "string"
responses: responses:
405: 405:
description: "Invalid input" description: "Invalid input"
security: security:
- petstore_auth: - petstore_auth:
- "write:pets" - "write_pets"
- "read:pets" - "read_pets"
x-swagger-router-controller: "Pet" x-swagger-router-controller: "Pet"
delete: delete:
tags: tags:
- "pet" - "pet"
summary: "Deletes a pet" summary: "Deletes a pet"
description: ""
operationId: "deletePet" operationId: "deletePet"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- name: "api_key" - name: "api_key"
in: "header" in: "header"
required: false description: ""
required: true
type: "string" type: "string"
- name: "petId" - name: "petId"
in: "path" in: "path"
@ -247,86 +234,27 @@ paths:
format: "int64" format: "int64"
responses: responses:
400: 400:
description: "Invalid ID supplied" description: "Invalid pet value"
404:
description: "Pet not found"
security: security:
- petstore_auth: - petstore_auth:
- "write:pets" - "write_pets"
- "read:pets" - "read_pets"
x-swagger-router-controller: "Pet" x-swagger-router-controller: "Pet"
/pet/{petId}/uploadImage: /stores/order:
post:
tags:
- "pet"
summary: "uploads an image"
operationId: "uploadFile"
consumes:
- "multipart/form-data"
produces:
- "application/json"
parameters:
- name: "petId"
in: "path"
description: "ID of pet to update"
required: true
type: "integer"
format: "int64"
- name: "additionalMetadata"
in: "formData"
description: "Additional data to pass to server"
required: false
type: "string"
- name: "file"
in: "formData"
description: "file to upload"
required: false
type: "file"
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/ApiResponse"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
x-swagger-router-controller: "Pet"
/store/inventory:
get:
tags:
- "store"
summary: "Returns pet inventories by status"
description: "Returns a map of status codes to quantities"
operationId: "getInventory"
produces:
- "application/json"
parameters: []
responses:
200:
description: "successful operation"
schema:
type: "object"
additionalProperties:
type: "integer"
format: "int32"
security:
- api_key: []
x-swagger-router-controller: "Store"
/store/order:
post: post:
tags: tags:
- "store" - "store"
summary: "Place an order for a pet" summary: "Place an order for a pet"
description: ""
operationId: "placeOrder" operationId: "placeOrder"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- in: "body" - in: "body"
name: "body" name: "body"
description: "order placed for purchasing the pet" description: "order placed for purchasing the pet"
required: true required: false
schema: schema:
$ref: "#/definitions/Order" $ref: "#/definitions/Order"
responses: responses:
@ -337,26 +265,23 @@ paths:
400: 400:
description: "Invalid Order" description: "Invalid Order"
x-swagger-router-controller: "Store" x-swagger-router-controller: "Store"
/store/order/{orderId}: /stores/order/{orderId}:
get: get:
tags: tags:
- "store" - "store"
summary: "Find purchase order by ID" summary: "Find purchase order by ID"
description: "For valid response try integer IDs with value >= 1 and <= 10.\n\ description: "For valid response try integer IDs with value <= 5 or > 10. Other\
Other values will generated exceptions\n" \ values will generated exceptions"
operationId: "getOrderById" operationId: "getOrderById"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- name: "orderId" - name: "orderId"
in: "path" in: "path"
description: "ID of pet that needs to be fetched" description: "ID of pet that needs to be fetched"
required: true required: true
type: "integer" type: "string"
maximum: 10
minimum: 1
format: "int64"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
@ -371,27 +296,25 @@ paths:
tags: tags:
- "store" - "store"
summary: "Delete purchase order by ID" summary: "Delete purchase order by ID"
description: "For valid response try integer IDs with positive integer value.\\\ description: "For valid response try integer IDs with value < 1000. Anything\
\ \\ Negative or non-integer values will generate API errors" \ above 1000 or nonintegers will generate API errors"
operationId: "deleteOrder" operationId: "deleteOrder"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- name: "orderId" - name: "orderId"
in: "path" in: "path"
description: "ID of the order that needs to be deleted" description: "ID of the order that needs to be deleted"
required: true required: true
type: "integer" type: "string"
minimum: 1
format: "int64"
responses: responses:
400: 400:
description: "Invalid ID supplied" description: "Invalid ID supplied"
404: 404:
description: "Order not found" description: "Order not found"
x-swagger-router-controller: "Store" x-swagger-router-controller: "Store"
/user: /users:
post: post:
tags: tags:
- "user" - "user"
@ -399,33 +322,34 @@ paths:
description: "This can only be done by the logged in user." description: "This can only be done by the logged in user."
operationId: "createUser" operationId: "createUser"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- in: "body" - in: "body"
name: "body" name: "body"
description: "Created user object" description: "Created user object"
required: true required: false
schema: schema:
$ref: "#/definitions/User" $ref: "#/definitions/User"
responses: responses:
default: default:
description: "successful operation" description: "successful operation"
x-swagger-router-controller: "User" x-swagger-router-controller: "User"
/user/createWithArray: /users/createWithArray:
post: post:
tags: tags:
- "user" - "user"
summary: "Creates list of users with given input array" summary: "Creates list of users with given input array"
description: ""
operationId: "createUsersWithArrayInput" operationId: "createUsersWithArrayInput"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- in: "body" - in: "body"
name: "body" name: "body"
description: "List of user object" description: "List of user object"
required: true required: false
schema: schema:
type: "array" type: "array"
items: items:
@ -434,20 +358,21 @@ paths:
default: default:
description: "successful operation" description: "successful operation"
x-swagger-router-controller: "User" x-swagger-router-controller: "User"
/user/createWithList: /users/createWithList:
post: post:
tags: tags:
- "user" - "user"
summary: "Creates list of users with given input array" summary: "Creates list of users with given input array"
description: ""
operationId: "createUsersWithListInput" operationId: "createUsersWithListInput"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- in: "body" - in: "body"
name: "body" name: "body"
description: "List of user object" description: "List of user object"
required: true required: false
schema: schema:
type: "array" type: "array"
items: items:
@ -456,67 +381,60 @@ paths:
default: default:
description: "successful operation" description: "successful operation"
x-swagger-router-controller: "User" x-swagger-router-controller: "User"
/user/login: /users/login:
get: get:
tags: tags:
- "user" - "user"
summary: "Logs user into the system" summary: "Logs user into the system"
description: ""
operationId: "loginUser" operationId: "loginUser"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- name: "username" - name: "username"
in: "query" in: "query"
description: "The user name for login" description: "The user name for login"
required: true required: false
type: "string" type: "string"
- name: "password" - name: "password"
in: "query" in: "query"
description: "The password for login in clear text" description: "The password for login in clear text"
required: true required: false
type: "string" type: "string"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
schema: schema:
type: "string" type: "string"
headers:
X-Rate-Limit:
type: "integer"
format: "int32"
description: "calls per hour allowed by the user"
X-Expires-After:
type: "string"
format: "date-time"
description: "date in UTC when token expires"
400: 400:
description: "Invalid username/password supplied" description: "Invalid username/password supplied"
x-swagger-router-controller: "User" x-swagger-router-controller: "User"
/user/logout: /users/logout:
get: get:
tags: tags:
- "user" - "user"
summary: "Logs out current logged in user session" summary: "Logs out current logged in user session"
description: "null" description: ""
operationId: "logoutUser" operationId: "logoutUser"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: [] parameters: []
responses: responses:
default: default:
description: "successful operation" description: "successful operation"
x-swagger-router-controller: "User" x-swagger-router-controller: "User"
/user/{username}: /users/{username}:
get: get:
tags: tags:
- "user" - "user"
summary: "Get user by user name" summary: "Get user by user name"
description: ""
operationId: "getUserByName" operationId: "getUserByName"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- name: "username" - name: "username"
in: "path" in: "path"
@ -540,18 +458,18 @@ paths:
description: "This can only be done by the logged in user." description: "This can only be done by the logged in user."
operationId: "updateUser" operationId: "updateUser"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- name: "username" - name: "username"
in: "path" in: "path"
description: "name that need to be updated" description: "name that need to be deleted"
required: true required: true
type: "string" type: "string"
- in: "body" - in: "body"
name: "body" name: "body"
description: "Updated user object" description: "Updated user object"
required: true required: false
schema: schema:
$ref: "#/definitions/User" $ref: "#/definitions/User"
responses: responses:
@ -567,8 +485,8 @@ paths:
description: "This can only be done by the logged in user." description: "This can only be done by the logged in user."
operationId: "deleteUser" operationId: "deleteUser"
produces: produces:
- "application/xml"
- "application/json" - "application/json"
- "application/xml"
parameters: parameters:
- name: "username" - name: "username"
in: "path" in: "path"
@ -588,39 +506,12 @@ securityDefinitions:
in: "header" in: "header"
petstore_auth: petstore_auth:
type: "oauth2" type: "oauth2"
authorizationUrl: "http://petstore.swagger.io/oauth/dialog" authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog"
flow: "implicit" flow: "implicit"
scopes: scopes:
write:pets: "modify pets in your account" write_pets: "modify pets in your account"
read:pets: "read your pets" read_pets: "read your pets"
definitions: definitions:
Order:
type: "object"
properties:
id:
type: "integer"
format: "int64"
petId:
type: "integer"
format: "int64"
quantity:
type: "integer"
format: "int32"
shipDate:
type: "string"
format: "date-time"
status:
type: "string"
description: "Order Status"
enum:
- "placed"
- "approved"
- "delivered"
complete:
type: "boolean"
default: false
xml:
name: "Order"
User: User:
type: "object" type: "object"
properties: properties:
@ -643,8 +534,6 @@ definitions:
type: "integer" type: "integer"
format: "int32" format: "int32"
description: "User Status" description: "User Status"
xml:
name: "User"
Category: Category:
type: "object" type: "object"
properties: properties:
@ -653,18 +542,6 @@ definitions:
format: "int64" format: "int64"
name: name:
type: "string" type: "string"
xml:
name: "Category"
Tag:
type: "object"
properties:
id:
type: "integer"
format: "int64"
name:
type: "string"
xml:
name: "Tag"
Pet: Pet:
type: "object" type: "object"
required: required:
@ -681,37 +558,40 @@ definitions:
example: "doggie" example: "doggie"
photoUrls: photoUrls:
type: "array" type: "array"
xml:
name: "photoUrl"
wrapped: true
items: items:
type: "string" type: "string"
tags: tags:
type: "array" type: "array"
xml:
name: "tag"
wrapped: true
items: items:
$ref: "#/definitions/Tag" $ref: "#/definitions/Tag"
status: status:
type: "string" type: "string"
description: "pet status in the store" description: "pet status in the store"
enum: Tag:
- "available"
- "pending"
- "sold"
xml:
name: "Pet"
ApiResponse:
type: "object" type: "object"
properties: properties:
code: id:
type: "integer"
format: "int64"
name:
type: "string"
Order:
type: "object"
properties:
id:
type: "integer"
format: "int64"
petId:
type: "integer"
format: "int64"
quantity:
type: "integer" type: "integer"
format: "int32" format: "int32"
type: shipDate:
type: "string" type: "string"
message: format: "date-time"
status:
type: "string" type: "string"
externalDocs: description: "Order Status"
description: "Find out more about Swagger" complete:
url: "http://swagger.io" type: "boolean"

View File

@ -33,7 +33,3 @@ module.exports.updatePet = function updatePet (req, res, next) {
module.exports.updatePetWithForm = function updatePetWithForm (req, res, next) { module.exports.updatePetWithForm = function updatePetWithForm (req, res, next) {
Pet.updatePetWithForm(req.swagger.params, 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

@ -6,20 +6,16 @@ exports.addPet = function(args, res, next) {
* body (Pet) * body (Pet)
**/ **/
// no response value expected for this operation // no response value expected for this operation
res.end(); res.end();
} }
exports.deletePet = function(args, res, next) { exports.deletePet = function(args, res, next) {
/** /**
* parameters expected in the args: * parameters expected in the args:
* petId (Long)
* apiKey (String) * apiKey (String)
* petId (Long)
**/ **/
// no response value expected for this operation // no response value expected for this operation
res.end(); res.end();
} }
@ -28,8 +24,6 @@ exports.findPetsByStatus = function(args, res, next) {
* parameters expected in the args: * parameters expected in the args:
* status (List) * status (List)
**/ **/
var examples = {}; var examples = {};
examples['application/json'] = [ { examples['application/json'] = [ {
"tags" : [ { "tags" : [ {
@ -45,7 +39,6 @@ exports.findPetsByStatus = function(args, res, next) {
"name" : "doggie", "name" : "doggie",
"photoUrls" : [ "aeiou" ] "photoUrls" : [ "aeiou" ]
} ]; } ];
if(Object.keys(examples).length > 0) { if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json'); res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@ -54,7 +47,6 @@ exports.findPetsByStatus = function(args, res, next) {
res.end(); res.end();
} }
} }
exports.findPetsByTags = function(args, res, next) { exports.findPetsByTags = function(args, res, next) {
@ -62,8 +54,6 @@ exports.findPetsByTags = function(args, res, next) {
* parameters expected in the args: * parameters expected in the args:
* tags (List) * tags (List)
**/ **/
var examples = {}; var examples = {};
examples['application/json'] = [ { examples['application/json'] = [ {
"tags" : [ { "tags" : [ {
@ -79,7 +69,6 @@ exports.findPetsByTags = function(args, res, next) {
"name" : "doggie", "name" : "doggie",
"photoUrls" : [ "aeiou" ] "photoUrls" : [ "aeiou" ]
} ]; } ];
if(Object.keys(examples).length > 0) { if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json'); res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@ -88,7 +77,6 @@ exports.findPetsByTags = function(args, res, next) {
res.end(); res.end();
} }
} }
exports.getPetById = function(args, res, next) { exports.getPetById = function(args, res, next) {
@ -96,8 +84,6 @@ exports.getPetById = function(args, res, next) {
* parameters expected in the args: * parameters expected in the args:
* petId (Long) * petId (Long)
**/ **/
var examples = {}; var examples = {};
examples['application/json'] = { examples['application/json'] = {
"tags" : [ { "tags" : [ {
@ -113,7 +99,6 @@ exports.getPetById = function(args, res, next) {
"name" : "doggie", "name" : "doggie",
"photoUrls" : [ "aeiou" ] "photoUrls" : [ "aeiou" ]
}; };
if(Object.keys(examples).length > 0) { if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json'); res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@ -122,7 +107,6 @@ exports.getPetById = function(args, res, next) {
res.end(); res.end();
} }
} }
exports.updatePet = function(args, res, next) { exports.updatePet = function(args, res, next) {
@ -131,48 +115,17 @@ exports.updatePet = function(args, res, next) {
* body (Pet) * body (Pet)
**/ **/
// no response value expected for this operation // no response value expected for this operation
res.end(); res.end();
} }
exports.updatePetWithForm = function(args, res, next) { exports.updatePetWithForm = function(args, res, next) {
/** /**
* parameters expected in the args: * parameters expected in the args:
* petId (Long) * petId (String)
* name (String) * name (String)
* status (String) * status (String)
**/ **/
// no response value expected for this operation // no response value expected for this operation
res.end(); 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,10 +10,6 @@ module.exports.deleteOrder = function deleteOrder (req, res, next) {
Store.deleteOrder(req.swagger.params, 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) { module.exports.getOrderById = function getOrderById (req, res, next) {
Store.getOrderById(req.swagger.params, res, next); Store.getOrderById(req.swagger.params, res, next);
}; };

View File

@ -3,43 +3,17 @@
exports.deleteOrder = function(args, res, next) { exports.deleteOrder = function(args, res, next) {
/** /**
* parameters expected in the args: * parameters expected in the args:
* orderId (Long) * orderId (String)
**/ **/
// no response value expected for this operation // no response value expected for this operation
res.end(); 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) { exports.getOrderById = function(args, res, next) {
/** /**
* parameters expected in the args: * parameters expected in the args:
* orderId (Long) * orderId (String)
**/ **/
var examples = {}; var examples = {};
examples['application/json'] = { examples['application/json'] = {
"id" : 123456789, "id" : 123456789,
@ -49,7 +23,6 @@ exports.getOrderById = function(args, res, next) {
"quantity" : 123, "quantity" : 123,
"shipDate" : "2000-01-23T04:56:07.000+0000" "shipDate" : "2000-01-23T04:56:07.000+0000"
}; };
if(Object.keys(examples).length > 0) { if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json'); res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@ -58,7 +31,6 @@ exports.getOrderById = function(args, res, next) {
res.end(); res.end();
} }
} }
exports.placeOrder = function(args, res, next) { exports.placeOrder = function(args, res, next) {
@ -66,8 +38,6 @@ exports.placeOrder = function(args, res, next) {
* parameters expected in the args: * parameters expected in the args:
* body (Order) * body (Order)
**/ **/
var examples = {}; var examples = {};
examples['application/json'] = { examples['application/json'] = {
"id" : 123456789, "id" : 123456789,
@ -77,7 +47,6 @@ exports.placeOrder = function(args, res, next) {
"quantity" : 123, "quantity" : 123,
"shipDate" : "2000-01-23T04:56:07.000+0000" "shipDate" : "2000-01-23T04:56:07.000+0000"
}; };
if(Object.keys(examples).length > 0) { if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json'); res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@ -86,6 +55,5 @@ exports.placeOrder = function(args, res, next) {
res.end(); res.end();
} }
} }

View File

@ -6,8 +6,6 @@ exports.createUser = function(args, res, next) {
* body (User) * body (User)
**/ **/
// no response value expected for this operation // no response value expected for this operation
res.end(); res.end();
} }
@ -17,8 +15,6 @@ exports.createUsersWithArrayInput = function(args, res, next) {
* body (List) * body (List)
**/ **/
// no response value expected for this operation // no response value expected for this operation
res.end(); res.end();
} }
@ -28,8 +24,6 @@ exports.createUsersWithListInput = function(args, res, next) {
* body (List) * body (List)
**/ **/
// no response value expected for this operation // no response value expected for this operation
res.end(); res.end();
} }
@ -39,8 +33,6 @@ exports.deleteUser = function(args, res, next) {
* username (String) * username (String)
**/ **/
// no response value expected for this operation // no response value expected for this operation
res.end(); res.end();
} }
@ -49,8 +41,6 @@ exports.getUserByName = function(args, res, next) {
* parameters expected in the args: * parameters expected in the args:
* username (String) * username (String)
**/ **/
var examples = {}; var examples = {};
examples['application/json'] = { examples['application/json'] = {
"id" : 123456789, "id" : 123456789,
@ -62,7 +52,6 @@ exports.getUserByName = function(args, res, next) {
"firstName" : "aeiou", "firstName" : "aeiou",
"password" : "aeiou" "password" : "aeiou"
}; };
if(Object.keys(examples).length > 0) { if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json'); res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@ -71,7 +60,6 @@ exports.getUserByName = function(args, res, next) {
res.end(); res.end();
} }
} }
exports.loginUser = function(args, res, next) { exports.loginUser = function(args, res, next) {
@ -80,11 +68,8 @@ exports.loginUser = function(args, res, next) {
* username (String) * username (String)
* password (String) * password (String)
**/ **/
var examples = {}; var examples = {};
examples['application/json'] = "aeiou"; examples['application/json'] = "aeiou";
if(Object.keys(examples).length > 0) { if(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json'); res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
@ -93,7 +78,6 @@ exports.loginUser = function(args, res, next) {
res.end(); res.end();
} }
} }
exports.logoutUser = function(args, res, next) { exports.logoutUser = function(args, res, next) {
@ -101,8 +85,6 @@ exports.logoutUser = function(args, res, next) {
* parameters expected in the args: * parameters expected in the args:
**/ **/
// no response value expected for this operation // no response value expected for this operation
res.end(); res.end();
} }
@ -113,8 +95,6 @@ exports.updateUser = function(args, res, next) {
* body (User) * body (User)
**/ **/
// no response value expected for this operation // no response value expected for this operation
res.end(); res.end();
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "swagger-petstore", "name": "swagger-petstore",
"version": "1.0.0", "version": "1.0.0",
"description": "This is a sample server Petstore server. You can find out more about\nSwagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).\nFor this sample, you can use the api key `special-key` to test the authorization filters.\n", "description": "This is a sample server Petstore server.\n\n[Learn about Swagger](http://swagger.io) or join the IRC channel `#swagger` on irc.freenode.net.\n\nFor this sample, you can use the api key `special-key` to test the authorization filters\n",
"main": "index.js", "main": "index.js",
"keywords": [ "keywords": [
"swagger" "swagger"