From aaac434ebb2647e8d5383f0642580c0c4983b382 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 29 Mar 2017 13:30:48 +0300 Subject: [PATCH] fix: add safeguard for undefined closes #236 --- lib/utils/spec-manager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/spec-manager.ts b/lib/utils/spec-manager.ts index a98cafb300..5f341b1dbe 100644 --- a/lib/utils/spec-manager.ts +++ b/lib/utils/spec-manager.ts @@ -189,7 +189,7 @@ export class SpecManager { // check if parent definition name is in the enum of possible values if (definition.discriminator) { let prop = definition.properties[definition.discriminator]; - if (prop.enum && prop.enum.indexOf(JsonPointer.baseName(defPointer)) > -1) { + if (prop && prop.enum && prop.enum.indexOf(JsonPointer.baseName(defPointer)) > -1) { res.push({ name: JsonPointer.baseName(defPointer), $ref: defPointer