Skip to content

Commit 90c60fc

Browse files
Fixing 'content' being expected to be present. (#369)
1 parent c49fc0f commit 90c60fc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/types/OpenAPI3.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export interface OpenAPI3ResponseObject {
5757

5858
export interface OpenAPI3RequestBody {
5959
description?: string;
60-
content: {
60+
content?: {
6161
[contentType: string]: { schema: OpenAPI3SchemaObject | { $ref: string } };
6262
};
6363
}

src/v3.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export default function generateTypesV3(
225225
// handle requestBody
226226
if (operation.requestBody) {
227227
output += `requestBody: {\n`;
228-
Object.entries(operation.requestBody.content).forEach(
228+
Object.entries(operation.requestBody.content || {}).forEach(
229229
([contentType, { schema }]) => {
230230
output += `"${contentType}": ${transform(schema)};\n`;
231231
}

0 commit comments

Comments
 (0)