mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-11 03:16:48 +03:00
Filtered main tags from tags list
This commit is contained in:
parent
c0e4e6004a
commit
a825d98a4d
|
@ -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');
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user