Skip to content

Commit 1e96f88

Browse files
committed
fix: redoc hangs when indexing recursive discriminator-based definitions
closes: #228
1 parent 64e5741 commit 1e96f88

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/services/search.service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,12 @@ export class SearchService {
186186
let title = name;
187187
schema = this.normalizer.normalize(schema, schema._pointer || absolutePointer, { childFor: parent });
188188

189+
if (schema._pointer === parent) return;
190+
189191
let body = schema.description; // TODO: defaults, examples, etc...
190192

191193
if (schema.type === 'array') {
192-
this.indexSchema(schema.items, title, JsonPointer.join(absolutePointer, ['items']), menuPointer);
194+
this.indexSchema(schema.items, title, JsonPointer.join(absolutePointer, ['items']), menuPointer, parent);
193195
return;
194196
}
195197

@@ -218,7 +220,8 @@ export class SearchService {
218220
if (schema.properties) {
219221
Object.keys(schema.properties).forEach(propName => {
220222
let propPtr = JsonPointer.join(absolutePointer, ['properties', propName]);
221-
this.indexSchema(schema.properties[propName], propName, propPtr, menuPointer);
223+
let prop:SwaggerSchema = schema.properties[propName];
224+
this.indexSchema(prop, propName, propPtr, menuPointer, parent);
222225
});
223226
}
224227
}

0 commit comments

Comments
 (0)