openapi-typescript
Advanced tools
Comparing version 3.0.0-alpha.2 to 3.0.0-alpha.3
@@ -339,6 +339,8 @@ 'use strict'; | ||
if (response.content) { | ||
if (response.content && Object.keys(response.content).length) { | ||
output += ` content: {\n`; | ||
Object.entries(response.content).forEach(([contentType, contentResponse]) => { | ||
output += ` "${contentType}": ${transformSchemaObj(contentResponse.schema)};\n`; | ||
output += ` "${contentType}": ${transformSchemaObj(contentResponse.schema)};\n`; | ||
}); | ||
output += ` }\n`; | ||
} else if (response.schema) { | ||
@@ -368,7 +370,7 @@ output += ` schema: ${transformSchemaObj(response.schema)};\n`; | ||
if (Object.keys(operation.requestBody.content).length) { | ||
output += ` requestBody: {\n`; | ||
output += ` requestBody: {\n content: {\n`; | ||
Object.entries(operation.requestBody.content).forEach(([k, v]) => { | ||
output += ` "${k}": ${transformSchemaObj(v.schema)};\n`; | ||
output += ` "${k}": ${transformSchemaObj(v.schema)};\n`; | ||
}); | ||
output += ` }\n`; | ||
output += ` }\n }\n`; | ||
} else { | ||
@@ -375,0 +377,0 @@ output += ` requestBody: unknown;\n`; |
@@ -17,7 +17,7 @@ import { comment } from "../utils"; | ||
if (Object.keys(operation.requestBody.content).length) { | ||
output += ` requestBody: {\n`; | ||
output += ` requestBody: {\n content: {\n`; | ||
Object.entries(operation.requestBody.content).forEach(([k, v]) => { | ||
output += ` "${k}": ${transformSchemaObj(v.schema)};\n`; | ||
output += ` "${k}": ${transformSchemaObj(v.schema)};\n`; | ||
}); | ||
output += ` }\n`; | ||
output += ` }\n }\n`; | ||
} | ||
@@ -24,0 +24,0 @@ else { |
@@ -28,6 +28,8 @@ import { comment, transformRef } from "../utils"; | ||
} | ||
if (response.content) { | ||
if (response.content && Object.keys(response.content).length) { | ||
output += ` content: {\n`; | ||
Object.entries(response.content).forEach(([contentType, contentResponse]) => { | ||
output += ` "${contentType}": ${transformSchemaObj(contentResponse.schema)};\n`; | ||
output += ` "${contentType}": ${transformSchemaObj(contentResponse.schema)};\n`; | ||
}); | ||
output += ` }\n`; | ||
} | ||
@@ -34,0 +36,0 @@ else if (response.schema) { |
{ | ||
"name": "openapi-typescript", | ||
"description": "Generate TypeScript types from Swagger OpenAPI specs", | ||
"version": "3.0.0-alpha.2", | ||
"version": "3.0.0-alpha.3", | ||
"license": "ISC", | ||
@@ -6,0 +6,0 @@ "bin": { |
Sorry, the diff of this file is not supported yet
102159
1246