fix: fix crash when discriminator is used incorrectly

This commit is contained in:
Roman Hotsiy 2018-02-23 15:02:04 +02:00
parent 0192b70235
commit b1d928dbd3
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -198,6 +198,7 @@ export class SpecManager {
let definition = schema || this.byPointer(defPointer);
if (!definition) throw new Error(`Can't load schema at ${defPointer}`);
if (!definition.discriminator && !definition['x-extendedDiscriminator']) return [];
if (defPointer === undefined) return [];
let globalDefs = this._schema.definitions || {};
let res:DescendantInfo[] = [];