From 1e96f88ea8320523080a11e5c6ed158b8e9a8280 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Thu, 9 Mar 2017 19:59:59 +0200 Subject: [PATCH] fix: redoc hangs when indexing recursive discriminator-based definitions closes: #228 --- lib/services/search.service.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/services/search.service.ts b/lib/services/search.service.ts index 93b90055..a847b463 100644 --- a/lib/services/search.service.ts +++ b/lib/services/search.service.ts @@ -186,10 +186,12 @@ export class SearchService { let title = name; schema = this.normalizer.normalize(schema, schema._pointer || absolutePointer, { childFor: parent }); + if (schema._pointer === parent) return; + let body = schema.description; // TODO: defaults, examples, etc... if (schema.type === 'array') { - this.indexSchema(schema.items, title, JsonPointer.join(absolutePointer, ['items']), menuPointer); + this.indexSchema(schema.items, title, JsonPointer.join(absolutePointer, ['items']), menuPointer, parent); return; } @@ -218,7 +220,8 @@ export class SearchService { if (schema.properties) { Object.keys(schema.properties).forEach(propName => { let propPtr = JsonPointer.join(absolutePointer, ['properties', propName]); - this.indexSchema(schema.properties[propName], propName, propPtr, menuPointer); + let prop:SwaggerSchema = schema.properties[propName]; + this.indexSchema(prop, propName, propPtr, menuPointer, parent); }); } }