Filtered main tags from tags list

This commit is contained in:
Roman Hotsiy 2015-11-17 01:34:13 +02:00
parent c0e4e6004a
commit a825d98a4d
2 changed files with 19 additions and 0 deletions

View File

@ -24,9 +24,15 @@ export default class Method extends BaseComponent {
this.data.method = JsonPointer.baseName(this.pointer);
this.data.path = JsonPointer.baseName(this.pointer, 2);
this.data.methodInfo = this.componentSchema;
this.data.methodInfo.tags = this.filterMainTags(this.data.methodInfo.tags);
this.data.bodyParam = this.findBodyParam();
}
filterMainTags(tags) {
var tagsMap = this.schemaMgr.getTagsMap();
return tags.filter(tag => tagsMap[tag]['x-secondaryTag']);
}
findBodyParam() {
let pathParams = this.schemaMgr.getMethodParams(JsonPointer.join(this.pointer, 'parameters'), true);
let bodyParam = pathParams.find(param => param.in === 'body');

View File

@ -92,6 +92,19 @@ export default class SchemaManager {
return methodParams.concat(pathParams);
}
getTagsMap() {
let tags = this._schema.tags || [];
var tagsMap = {};
for (let tag of tags) {
tagsMap[tag.name] = {
description: tag.description,
'x-secondaryTag': tag['x-secondaryTag']
};
}
return tagsMap;
}
/* returns ES6 Map */
buildMenuTree() {
let tag2MethodMapping = new Map();