Skip to content

Commit

Permalink
Update openapi.request.validator.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
mirekgw committed Mar 2, 2020
1 parent 89153ea commit 609235d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/middlewares/openapi.request.validator.ts
Expand Up @@ -92,8 +92,10 @@ export class RequestValidator {
const securityQueryParam = Security.queryParam(apiDoc, reqSchema);
const body = bodySchemaParser.parse(path, reqSchema, contentType);

const properties: ValidationSchema = { ...parameters, body: body };
const required = (<SchemaObject>body).required ? ['body'] : [];
// when the body type is 'application/octet-stream' don't validate the body
const isOctetStream = contentType.contentType === 'application/octet-stream';
const properties: ValidationSchema = { ...parameters, body: ( isOctetStream ? {} : body) };
const required = ((<SchemaObject>body).required && !isOctetStream) ? ['body'] : [];

// $schema: "http://json-schema.org/draft-04/schema#",
const schema = {
Expand Down

0 comments on commit 609235d

Please sign in to comment.