sails-swagger icon indicating copy to clipboard operation
sails-swagger copied to clipboard

custom parameters are missing

Open nagavenkatab opened this issue 7 years ago • 1 comments

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"
        ]
      }
    }

nagavenkatab avatar Dec 29 '17 12:12 nagavenkatab

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

a4712020502 avatar May 15 '18 12:05 a4712020502