fix: redoc hangs when indexing recursive discriminator-based definitions

closes: #228
This commit is contained in:
Roman Hotsiy 2017-03-09 19:59:59 +02:00
parent 64e5741f67
commit 1e96f88ea8
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

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