Skip to content

Commit

Permalink
fix: redoc hangs when indexing recursive discriminator-based definitions
Browse files Browse the repository at this point in the history
closes: #228
  • Loading branch information
RomanHotsiy committed Mar 9, 2017
1 parent 64e5741 commit 1e96f88
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/services/search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
});
}
}
Expand Down

0 comments on commit 1e96f88

Please sign in to comment.