feat: add webhooks supporting

This commit is contained in:
Alex Varchuk 2021-05-21 16:37:03 +03:00
parent c342f6f0f5
commit 17d05667af
2 changed files with 7 additions and 4 deletions

View File

@ -6,7 +6,7 @@ describe('Menu', () => {
it('should have valid items count', () => {
cy.get('.menu-content')
.find('li')
.should('have.length', 33);
.should('have.length', 34);
});
it('should sync active menu items while scroll', () => {

View File

@ -217,15 +217,18 @@ export class MenuBuilder {
*/
static getTagsWithOperations(spec: OpenAPISpec): TagsInfoMap {
const tags: TagsInfoMap = {};
const webhooks = spec['x-webhooks'] || spec.webhooks;
for (const tag of spec.tags || []) {
tags[tag.name] = { ...tag, operations: [] };
}
if (webhooks) {
getTags(webhooks, true);
}
if (spec.paths){
getTags(spec.paths);
}
if (spec.webhooks) {
getTags(spec.webhooks, true);
}
function getTags(paths: OpenAPIPaths, isWebhook?: boolean) {
for (const pathName of Object.keys(paths)) {