Q:

Swagger doesn't recognize x-www-urleconded parameters

I had a swagger documentation on version 2.0 
where i put the path consumes as application/x-www-urlencoded but when i try to request i receive the following error.
{
"message": "Request validation failed: Parameter (username) is required",
"code": "REQUIRED",
"failedValidation": true,
"path": [
    "paths",
    "/auth/login",
    "post",
    "parameters",
    "0"
],
"paramName": "username"
}

But i already passed the parameter as we can see on this curl 
curl -X POST \
http://localhost:10010/v1/auth/login \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'username=LOGIN&password=MYPASS&userType=employee'

I've used the following Swagger.yaml
Here you are the definition of.
definitions:
UserType: &UserType
 type: string
 enum: [customer, employee, supplier]
 description: >
        User Type:
         * customer.
         * employee.
         * supplier.

and here the path which is utilized.
paths: 
 /auth/login:
 # binds a127 app logic to a route
 x-swagger-router-controller: "authentication"
 x-a127-apply: {}
 post:
  summary: Try to login
  description: Try to login with credencials based on username/password. This API will return all "habitant" information if login were successful.
  # used as the method name of the controller
  operationId: login
  consumes: 
    - application/x-www-form-urlencoded
  tags: 
  - Auth
  parameters:
    - name: username
      in: formData
      description: Username to login.
      required: true
      type: string
    - name: password
      in: formData
      description: Password to login.
      required: true
      type: string
      format: password
    - name: userType
      in: formData
      required: true
      default: customer
      <<: *UserType
  responses:
    "200":
      description: Success. If there are attributes with empty values they won´t be returned
      schema:
        # a pointer to a definition
        $ref: "#/definitions/AuthResponse"
    "401":
      description: Unauthorized
      schema:
        $ref: "#/definitions/ErrorResponse"
    "500":
      description: Internal Server Error
      schema:
        $ref: "#/definitions/ErrorResponse"
    "501":
      description: Not Implemented
      schema:
        $ref: "#/definitions/ErrorResponse"

Thanks for any help. 

A:

I think it could be related to your middleware. Are you using express?
If so you may add something like this "app.use(express.urlencoded());"
You should take a look in this link: 
https://www.npmjs.com/package/express-xml-bodyparser

