diff --git a/src/openApi/v3/parser/getContent.ts b/src/openApi/v3/parser/getContent.ts index 38a43238..84f5cc11 100644 --- a/src/openApi/v3/parser/getContent.ts +++ b/src/openApi/v3/parser/getContent.ts @@ -23,7 +23,10 @@ const BASIC_MEDIA_TYPES = [ export function getContent(openApi: OpenApi, content: Dictionary): Content | null { const basicMediaTypeWithSchema = Object.keys(content) - .filter(mediaType => BASIC_MEDIA_TYPES.includes(mediaType)) + .filter(mediaType => { + const cleanMediaType = mediaType.split(';')[0].trim(); + return BASIC_MEDIA_TYPES.includes(cleanMediaType); + }) .find(mediaType => isDefined(content[mediaType]?.schema)); if (basicMediaTypeWithSchema) { return { diff --git a/test/spec/v3.json b/test/spec/v3.json index 9e3b25eb..83c9f819 100644 --- a/test/spec/v3.json +++ b/test/spec/v3.json @@ -127,7 +127,6 @@ "nullable": true, "content": { "application/json": { - "description": "Message for default response", "schema": { "$ref": "#/components/schemas/ModelWithString" } @@ -239,7 +238,6 @@ "nullable": true, "content": { "application/json": { - "description": "Message for default response", "schema": { "$ref": "#/components/schemas/ModelWithString" } @@ -270,7 +268,6 @@ "required": true, "content": { "application/json": { - "description": "Message for default response", "schema": { "$ref": "#/components/schemas/ModelWithString" } @@ -299,7 +296,6 @@ "required": false, "content": { "application/json": { - "description": "Message for default response", "schema": { "$ref": "#/components/schemas/ModelWithString" } @@ -611,7 +607,6 @@ "default": { "content": { "application/json": { - "description": "Message for default response", "schema": { "$ref": "#/components/schemas/ModelWithString" } @@ -1303,7 +1298,7 @@ "200": { "description": "Success", "content": { - "application/json": { + "application/json; type=collection": { "schema": { "$ref": "#/components/schemas/ModelWithString" }