sails-swagger
sails-swagger copied to clipboard
custom parameters are missing
With the current version of the npm package 0.51.0, the generated doc doesn't include the parameters specified for the routes.
['get /groups']: {
controller: 'authController',
action: 'login',
skipAssets: 'true',
//swagger path object
swagger: {
methods: ['GET'],
summary: ' Get Groups ',
description: 'Get Groups Description',
produces: [
'application/json'
],
tags: [
'Groups'
],
responses: {
'200': {
description: 'List of Groups',
schema: 'Group', //model,
type: 'array'
}
},
parameters: [{
"name": "id",
"in": "path",
"description": "ID of pet to use",
"required": true,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv"
}, {
"name": "name",
"in": "query",
"description": "ID of pet to use",
"required": true,
"type": "string"
}, 'Contact']
}
}
and the generated doc as below
"/groups": {
"get": {
"summary": "Read Object(s)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "The requested resource"
},
"404": {
"description": "Resource not found"
},
"500": {
"description": "Internal server error"
}
},
"tags": [
"auth"
]
}
}
I have the same problem with you.
'post /api/users/login': { controller : 'UserController', action: 'process2', skipAssets: 'true',
swagger: {
methods: ['GET', 'POST'],
summary: ' Get Groups ',
description: 'Get Groups Description',
body: {
username: { type: 'string', required: true },
password: { type: 'password', required: true }
},
parameters: [{
in: 'query',
name: 'firstName',
required: true,
type: 'string',
description: 'This is a custom required parameter'
}]
}
}
but not take effect