Skip to content

Commit

Permalink
fix: don't require a schema to exist under application/octet-stream (
Browse files Browse the repository at this point in the history
…#3137)

don't check for schema
  • Loading branch information
armandobelardo authored Mar 10, 2024
1 parent ecd00da commit bd714c3
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ function getMultipartFormDataRequest(
return requestBody.content[MULTIPART_CONTENT]?.schema;
}

function getOctetStreamRequest(
requestBody: OpenAPIV3.RequestBodyObject
): OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject | undefined {
return requestBody.content[OCTET_STREAM]?.schema;
function isOctetStreamRequest(requestBody: OpenAPIV3.RequestBodyObject): boolean {
return requestBody.content[OCTET_STREAM] != null;
}

function multipartRequestHasFile(
Expand Down Expand Up @@ -60,11 +58,10 @@ export function convertRequest({
: requestBody;

const multipartSchema = getMultipartFormDataRequest(resolvedRequestBody);
const octetStreamSchema = getOctetStreamRequest(resolvedRequestBody);
const jsonMediaObject = getApplicationJsonSchemaMediaObject(resolvedRequestBody.content);

// convert as application/octet-stream
if (octetStreamSchema != null) {
if (isOctetStreamRequest(resolvedRequestBody)) {
return RequestWithExample.octetStream({
description: undefined
});
Expand Down

0 comments on commit bd714c3

Please sign in to comment.