diff --git a/lib/components/JsonSchema/json-schema.ts b/lib/components/JsonSchema/json-schema.ts
index d7d41493..a4de8c8f 100644
--- a/lib/components/JsonSchema/json-schema.ts
+++ b/lib/components/JsonSchema/json-schema.ts
@@ -150,9 +150,14 @@ export class JsonSchema extends BaseSearchableComponent implements OnInit {
return item.name + (item._pointer || '');
}
+ trackByIdx(idx: number, _: any): number {
+ return idx;
+ }
+
ensureSearchIsShown(ptr: string) {
if (ptr.startsWith(this.absolutePointer)) {
let props = this.properties;
+ if (!props) return;
let relative = JsonPointer.relative(this.absolutePointer, ptr);
let propName;
if (relative.length > 1 && relative[0] === 'properties') {
diff --git a/lib/components/Search/redoc-search.html b/lib/components/Search/redoc-search.html
index 43ee86d9..f2f8939c 100644
--- a/lib/components/Search/redoc-search.html
+++ b/lib/components/Search/redoc-search.html
@@ -1,6 +1,6 @@
-
- {{item.menuItem.name}}
+ {{item?.menuItem?.name}}
-
diff --git a/lib/services/schema-normalizer.service.ts b/lib/services/schema-normalizer.service.ts
index ddec2bc3..7c62c457 100644
--- a/lib/services/schema-normalizer.service.ts
+++ b/lib/services/schema-normalizer.service.ts
@@ -94,7 +94,7 @@ class SchemaWalker {
}
}
-class AllOfMerger {
+export class AllOfMerger {
static merge(into, schemas) {
into['x-derived-from'] = [];
for (let i=0; i < schemas.length; i++) {
diff --git a/lib/services/search.service.ts b/lib/services/search.service.ts
index f16f72c3..9ca7c406 100644
--- a/lib/services/search.service.ts
+++ b/lib/services/search.service.ts
@@ -1,18 +1,19 @@
import { Injectable } from '@angular/core';
import { AppStateService } from './app-state.service';
-import { JsonPointer, groupBy, SpecManager, StringMap} from '../utils/';
+import { SchemaNormalizer } from './schema-normalizer.service';
+import { JsonPointer, groupBy, SpecManager, StringMap } from '../utils/';
import * as lunr from 'lunr';
interface IndexElement {
- menuPtr: string;
+ menuId: string;
title: string;
body: string;
pointer: string;
}
const index = lunr(function () {
- this.field('menuPtr', {boost: 0});
+ this.field('menuId', {boost: 0});
this.field('title', {boost: 1.5});
this.field('body');
this.ref('pointer');
@@ -22,7 +23,9 @@ const store:StringMap = {};
@Injectable()
export class SearchService {
+ normalizer: SchemaNormalizer;
constructor(private app: AppStateService, private spec: SpecManager) {
+ this.normalizer = new SchemaNormalizer(spec);
}
ensureSearchVisible(containingPointers: string[]) {
@@ -39,7 +42,7 @@ export class SearchService {
const res:IndexElement[] = index.search(q).map(res => {
return store[res.ref];
});
- const grouped = groupBy(res, 'menuPtr');
+ const grouped = groupBy(res, 'menuId');
return grouped;
}
@@ -61,14 +64,33 @@ export class SearchService {
});
}
- indexOperation(operation:any, opPtr:string) {
+ indexOperation(operation:any, operationPointer:string) {
this.index({
- pointer: opPtr,
- menuPtr: opPtr,
+ pointer: operationPointer,
+ menuId: operationPointer,
title: operation.summary,
body: operation.description
});
- this.indexOperationResponses(operation, opPtr);
+ this.indexOperationResponses(operation, operationPointer);
+ this.indexOperationParameters(operation, operationPointer)
+ }
+
+ indexOperationParameters(operation: any, operationPointer: string) {
+ const parameters = operation.parameters;
+ for (let i=0; i {
let propPtr = JsonPointer.join(absolutePointer, ['properties', propName]);