Skip to content

Commit

Permalink
fix: broken search after previous fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Mar 9, 2017
1 parent d99f256 commit 3e09b05
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/components/JsonSchema/json-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
18 changes: 8 additions & 10 deletions lib/services/search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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...

Expand All @@ -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 => {
Expand Down

0 comments on commit 3e09b05

Please sign in to comment.