apigee-127 / swagger-tools

A Node.js and browser module that provides tooling around Swagger.
MIT License
702 stars 371 forks source link

Error: Response validation failed: void does not allow a value #612

Open RudrikaFichadiya opened 5 years ago

RudrikaFichadiya commented 5 years ago

Defined path and response:

"/users/validateLogin":{
      "x-swagger-router-controller":  "users",
      "post": {
        "tags": ["Users"], 
        "operationId": "validateLogin",
        "parameters": [
          {
            "name":"data",
            "in":"body",
            "required":false,
            "schema":
            {
              "$ref":"#/definitions/Login"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "schema": {
              "type": "object",
              "properties": {
                "responseCode": {
                  "type": "number",
                  "example": "0,"
                },
                "message": {
                  "type": "string",
                  "example": "Success"
                },
                "errCode": {
                  "type": "number",
                  "example": 2002
                },
                "info": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }

My function returns response as: res.json({ responseCode: 0, message: 'Login successful', errCode : 4003, info: tokenData.token});

Where the info has string typed data.

Facing problem with this error : Error: Response validation failed: void does not allow a value