fix: broken search after previous fixes

This commit is contained in:
Roman Hotsiy 2017-03-09 22:37:17 +02:00
parent d99f2562ac
commit 3e09b0588a
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 9 additions and 11 deletions

View File

@ -91,8 +91,8 @@ export class JsonSchema extends BaseSearchableComponent implements OnInit {
}).sort((a, b) => {
return enumOrder[a.name] > enumOrder[b.name] ? 1 : -1;
});
this.descendants.forEach((d, idx) => d.idx = idx);
}
this.descendants.forEach((d, idx) => d.idx = idx);
this.selectDescendantByIdx(0);
}

View File

@ -186,7 +186,8 @@ export class SearchService {
let title = name;
schema = this.normalizer.normalize(schema, schema._pointer || absolutePointer, { childFor: parent });
if (schema._pointer === parent) return;
// prevent endless discriminator recursion
if (schema._pointer && schema._pointer === parent) return;
let body = schema.description; // TODO: defaults, examples, etc...
@ -207,15 +208,12 @@ export class SearchService {
body += ' ' + schema.enum.join(' ');
}
if (!parent) {
// redoc doesn't display top level descriptions and titles
this.index({
pointer: absolutePointer,
menuId: menuPointer,
title,
body
});
}
this.index({
pointer: absolutePointer,
menuId: menuPointer,
title,
body
});
if (schema.properties) {
Object.keys(schema.properties).forEach(propName => {