PayU / openapi-validator-middleware

Input validation using Swagger (Open API) and ajv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validation fails to parse string formData

igor-savin-ht opened this issue · comments

If parameters look like this:

     parameters:
       - name: username
         in: formData
         required: true
         type: string
         description: Authentication username.
       - name: password
         in: formData
         required: true
         type: string
         description: Authentication password.
       - name: params

then express-ajv-swagger-validation fails during initialization:

(node:14192) UnhandledPromiseRejectionWarning: TypeError: Cannot set property 'username' of undefined
at parameters.forEach.parameter (C:\sources\crm-api\api\node_modules\express-ajv-swagger-validation\src\middleware.js:278:41)
at Array.forEach ()
at buildParametersValidation (C:\sources\crm-api\api\node_modules\express-ajv-swagger-validation\src\middleware.js:257:16)
a

For some reason destination.properties is not set in such case.

Fixed with #31

released in version v0.6.2