PayU / openapi-validator-middleware

Input validation using Swagger (Open API) and ajv
Apache License 2.0
144 stars 50 forks source link

Request content-type is not validated against 'consumes' field #17

Closed igor-savin-ht closed 6 years ago

igor-savin-ht commented 6 years ago

If Swagger specifies 'consumes' field for the service or the route, would be nice if express-ajv-swagger-validaiton library would use this data to check if data was sent of appropriate type.

igor-savin-ht commented 6 years ago

Clarification: requests still seem to fail due to wrong data structure, but getting proper error about content-type being wrong would be more useful. I've created a test for this case in linked PR.

idanto commented 6 years ago

Thanks @igor-savin-ht.

Do you think that validating the content-type header vault against the consumes filed in the swagger will be good enough?

igor-savin-ht commented 6 years ago

@idanto Yeah, that would be perfect.