Skip to content

Commit 557f328

Browse files
committed
refactor: split input into more testable classes
1 parent f7c2899 commit 557f328

File tree

1 file changed

+15
-15
lines changed
  • packages/openapi-code-generator/src/core

1 file changed

+15
-15
lines changed

packages/openapi-code-generator/src/core/input.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ export class Input {
368368
operationId: string,
369369
suffix: "RequestBody" | `${string}Response`,
370370
) {
371+
371372
const filtered = Object.entries(mediaTypes)
372373
// Sometimes people pass `{}` as the MediaType for 204 responses, filter these out
373374
.filter(([, mediaType]) => Boolean(mediaType.schema))
@@ -376,20 +377,20 @@ export class Input {
376377

377378
return Object.fromEntries(
378379
filtered.map(([contentType, mediaType]) => {
379-
return [
380-
contentType,
381-
{
382-
schema: this.normalizeMediaTypeSchema(
383-
operationId,
384-
contentType,
385-
mediaType.schema,
386-
suffix,
387-
hasMultipleMediaTypes,
388-
),
389-
encoding: mediaType.encoding,
390-
},
391-
]
392-
}),
380+
return [
381+
contentType,
382+
{
383+
schema: this.normalizeMediaTypeSchema(
384+
operationId,
385+
contentType,
386+
mediaType.schema,
387+
suffix,
388+
hasMultipleMediaTypes,
389+
),
390+
encoding: mediaType.encoding,
391+
},
392+
]
393+
}),
393394
)
394395
}
395396

@@ -403,7 +404,6 @@ export class Input {
403404
const syntheticName = `${upperFirst(operationId)}${
404405
hasMultipleMediaTypes ? mediaTypeToIdentifier(mediaType) : ""
405406
}${suffix}`
406-
407407
const result = this.schemaNormalizer.normalizeSchemaObject(schema)
408408

409409
const shouldCreateVirtualType =

0 commit comments

Comments
 (0)