fix: handle case where items is array in indexer

fixes #304
This commit is contained in:
Roman Hotsiy 2017-07-20 15:48:12 +02:00
parent 6bb3bd8d21
commit 5e5db72ea4
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
3 changed files with 601 additions and 134 deletions

View File

@ -192,7 +192,13 @@ export class SearchService {
let body = schema.description; // TODO: defaults, examples, etc... let body = schema.description; // TODO: defaults, examples, etc...
if (schema.type === 'array') { if (schema.type === 'array') {
this.indexSchema(schema.items, title, JsonPointer.join(absolutePointer, ['items']), menuPointer, parent); if (Array.isArray(schema.items)) {
schema.items.map((itemSchema, idx) => {
this.indexSchema(itemSchema, title, JsonPointer.join(absolutePointer, ['items', idx]), menuPointer, parent);
});
} else {
this.indexSchema(schema.items, title, JsonPointer.join(absolutePointer, ['items']), menuPointer, parent);
}
return; return;
} }

View File

@ -50,24 +50,24 @@
"author": "Roman Hotsiy", "author": "Roman Hotsiy",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@angular/common": "^4.2.4", "@angular/common": "^4.3.1",
"@angular/compiler": "^4.2.4", "@angular/compiler": "^4.3.1",
"@angular/compiler-cli": "^4.2.4", "@angular/compiler-cli": "^4.3.1",
"@angular/core": "^4.2.4", "@angular/core": "^4.3.1",
"@angular/platform-browser": "^4.2.4", "@angular/platform-browser": "^4.3.1",
"@angular/platform-browser-dynamic": "^4.2.4", "@angular/platform-browser-dynamic": "^4.3.1",
"@angular/platform-server": "^4.2.4", "@angular/platform-server": "^4.3.1",
"@types/jasmine": "^2.5.53", "@types/jasmine": "^2.5.53",
"@types/requirejs": "^2.1.29", "@types/requirejs": "^2.1.29",
"@types/should": "^8.3.0", "@types/should": "^8.3.0",
"@types/swagger-schema-official": "^2.0.5", "@types/swagger-schema-official": "^2.0.5",
"@types/webpack": "^3.0.0", "@types/webpack": "^3.0.4",
"angular2-template-loader": "^0.6.2", "angular2-template-loader": "^0.6.2",
"awesome-typescript-loader": "^3.1.3", "awesome-typescript-loader": "^3.2.1",
"branch-release": "^1.0.3", "branch-release": "^1.0.3",
"chalk": "^1.1.3", "chalk": "^2.0.1",
"codelyzer": "^3.0.1", "codelyzer": "^3.1.2",
"conventional-changelog-cli": "^1.3.1", "conventional-changelog-cli": "^1.3.2",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"css-loader": "^0.28.1", "css-loader": "^0.28.1",
"deploy-to-gh-pages": "^1.3.3", "deploy-to-gh-pages": "^1.3.3",
@ -92,7 +92,7 @@
"karma-should": "^1.0.0", "karma-should": "^1.0.0",
"karma-sinon": "^1.0.4", "karma-sinon": "^1.0.4",
"karma-sourcemap-loader": "^0.3.7", "karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.3", "karma-webpack": "^2.0.4",
"mark.js": "github:julmot/mark.js", "mark.js": "github:julmot/mark.js",
"node-sass": "^4.5.3", "node-sass": "^4.5.3",
"openapi-sampler": "^0.4.1", "openapi-sampler": "^0.4.1",
@ -102,12 +102,12 @@
"raw-loader": "^0.5.1", "raw-loader": "^0.5.1",
"remarkable": "1.7.1", "remarkable": "1.7.1",
"rimraf": "^2.6.1", "rimraf": "^2.6.1",
"rxjs": "^5.4.1", "rxjs": "^5.4.2",
"sass-loader": "^6.0.6", "sass-loader": "^6.0.6",
"scrollparent": "^2.0.1", "scrollparent": "^2.0.1",
"shelljs": "^0.7.7", "shelljs": "^0.7.7",
"should": "^11.2.1", "should": "^11.2.1",
"sinon": "^2.3.5", "sinon": "^2.3.8",
"slugify": "^1.0.2", "slugify": "^1.0.2",
"source-map-loader": "^0.2.1", "source-map-loader": "^0.2.1",
"stream-http": "^2.7.0", "stream-http": "^2.7.0",
@ -115,12 +115,12 @@
"style-loader": "^0.18.2", "style-loader": "^0.18.2",
"swagger-schema-official": "^2.0.0-bab6bed", "swagger-schema-official": "^2.0.0-bab6bed",
"ts-helpers": "^1.1.1", "ts-helpers": "^1.1.1",
"tslint": "^5.2.0", "tslint": "^5.5.0",
"typescript": "^2.3.2", "typescript": "^2.4.2",
"webpack": "^3.0.0", "webpack": "^3.3.0",
"webpack-dev-server": "^2.5.0", "webpack-dev-server": "^2.5.1",
"webpack-merge": "^4.1.0", "webpack-merge": "^4.1.0",
"zone.js": "^0.8.10" "zone.js": "^0.8.14"
}, },
"dependencies": { "dependencies": {
"lunr": "1.0.0", "lunr": "1.0.0",

687
yarn.lock

File diff suppressed because it is too large Load Diff