naz / swagger-express-validator

Lightweight requrest/response validation middleware based on swagger/OpenAPI schema
MIT License
56 stars 24 forks source link

URL parameter type is not validating #39

Closed domanskyi closed 5 years ago

domanskyi commented 5 years ago

I have created validator:

    const config = {
        schema,
        preserveResponseContentType: false,
        returnRequestErrors: true,
        returnResponseErrors: true, 
        validateRequest: true,
        validateResponse: false,
        ajvRequestOptions: {
            coerceTypes: true,
        },
        ajvResponseOptions: {
            coerceTypes: true,
        },
    }

And have used this parameters:

      parameters: [
        {
          name: 'id',
          in: 'path',
          description: 'Id of job.',
          required: true,
          'x-example': 10,
          type: 'number',
        },
      ],

But when I`m making request to this route with something except number in id parameter I am still getting 200 response.

kibertoad commented 5 years ago

Why did you close it? Was it not an issue?

domanskyi commented 5 years ago

Just have seen another closed issue in which author had answered that parameters and query validation is not implemented.