The request body validator schema ignores the requestBody.required field from the OpenAPI spec. Instead, it treats the request body as required whenever there is exactly one content type defined:
|
if (_.keys(requestBody.content).length === 1) { |
|
// if application/json is the only specified format, it's required |
|
requestBodySchema.required.push('requestBody'); |
|
} |
Per the https://swagger.io/docs/specification/v3_0/describing-request-body/describing-request-body/, requestBody.required defaults to false. The number of content types should not determine whether the body is required. Is there a reason for this difference? Thanks!