Skip to content

Commit

Permalink
fix: Separate the mediaType value from bodyParams
Browse files Browse the repository at this point in the history
  • Loading branch information
skgndi12 committed Aug 6, 2023
1 parent 74063e4 commit 6780888
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/tspec/src/generator/openapiGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const getOpenapiPaths = (
const headerParams = getObjectPropertyByPath(spec, 'header', openapiSchemas) as any;
const cookieParams = getObjectPropertyByPath(spec, 'cookie', openapiSchemas) as any;

const bodyParams = getObjectPropertyByPath(spec, 'body', openapiSchemas) as any;
const { mediaType = '', ...bodyParams } = getObjectPropertyByPath(spec, 'body', openapiSchemas) as any;

const operation = {
operationId: `${controllerName}_${method}_${path}`,
Expand All @@ -127,7 +127,7 @@ export const getOpenapiPaths = (
description: bodyParams.description,
required: true,
content: {
[bodyParams.mediaType || 'application/json']: {
[mediaType || 'application/json']: {
schema: bodyParams,
},
},
Expand Down

0 comments on commit 6780888

Please sign in to comment.