From b24f69ffed4b1452ec90e6c47807aca55bc9d093 Mon Sep 17 00:00:00 2001 From: Vishal Shingala Date: Tue, 20 Jun 2023 10:40:31 +0530 Subject: [PATCH] Fixed issue where conversion to openapi 3 from swagger 2 definition was failing dur to typeerror --- packages/swagger2openapi/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/swagger2openapi/index.js b/packages/swagger2openapi/index.js index b07e19a0..788aa43f 100644 --- a/packages/swagger2openapi/index.js +++ b/packages/swagger2openapi/index.js @@ -171,7 +171,7 @@ function fixUpSubSchemaExtensions(schema,parent) { delete schema["x-discriminator"]; for (let entry in schema.discriminator.mapping) { let schemaOrRef = schema.discriminator.mapping[entry]; - if (schemaOrRef.startsWith('#/definitions/')) { + if (typeof schemaOrRef === 'string' && schemaOrRef.startsWith('#/definitions/')) { schema.discriminator.mapping[entry] = schemaOrRef.replace('#/definitions/','#/components/schemas/'); } }