From 17d05667afda400c21c77aa5c6c4ba2f46a4517f Mon Sep 17 00:00:00 2001 From: Alex Varchuk Date: Fri, 21 May 2021 16:37:03 +0300 Subject: [PATCH] feat: add webhooks supporting --- e2e/integration/menu.e2e.ts | 2 +- src/services/MenuBuilder.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/e2e/integration/menu.e2e.ts b/e2e/integration/menu.e2e.ts index fc703b6c..e1b053d1 100644 --- a/e2e/integration/menu.e2e.ts +++ b/e2e/integration/menu.e2e.ts @@ -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', () => { diff --git a/src/services/MenuBuilder.ts b/src/services/MenuBuilder.ts index 907a0256..8a45bb9b 100644 --- a/src/services/MenuBuilder.ts +++ b/src/services/MenuBuilder.ts @@ -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)) {