Skip to content

Commit

Permalink
Merge pull request #34 from skgndi12/fix/seperate-mediaType
Browse files Browse the repository at this point in the history
[bug-fix] Generated OAS contains an invalid property
  • Loading branch information
hyeonss0417 authored Aug 7, 2023
2 parents 74063e4 + 6780888 commit e78d668
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 e78d668

Please sign in to comment.