Skip to content

Commit 7f6b1aa

Browse files
Fixing 'content' being expected to be present.
1 parent 75e8448 commit 7f6b1aa

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
@@ -43,7 +43,7 @@ export interface OpenAPI3ResponseObject {
4343

4444
export interface OpenAPI3RequestBody {
4545
description?: string;
46-
content: {
46+
content?: {
4747
[contentType: string]: { schema: OpenAPI3SchemaObject | { $ref: string } };
4848
};
4949
}

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)