From ff8857f04e21fa1869a6fb50a979c5536bb23275 Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Thu, 30 Oct 2025 12:47:21 +0100 Subject: [PATCH 1/2] fix: prevent webook from crashing in case of openapi 3.0 --- src/core/plugins/oas31/components/webhooks.jsx | 3 +++ test/e2e-cypress/e2e/features/webhooks.cy.js | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/plugins/oas31/components/webhooks.jsx b/src/core/plugins/oas31/components/webhooks.jsx index 49ce6b2f338..ce97f6d7fd1 100644 --- a/src/core/plugins/oas31/components/webhooks.jsx +++ b/src/core/plugins/oas31/components/webhooks.jsx @@ -7,6 +7,9 @@ import { List } from "immutable" const Webhooks = ({ specSelectors, getComponent }) => { const operationDTOs = specSelectors.selectWebhooksOperations() + if (!operationDTOs) { + return null + } const pathItemNames = Object.keys(operationDTOs) const OperationContainer = getComponent("OperationContainer", true) diff --git a/test/e2e-cypress/e2e/features/webhooks.cy.js b/test/e2e-cypress/e2e/features/webhooks.cy.js index aca41d30be1..1ad14099224 100644 --- a/test/e2e-cypress/e2e/features/webhooks.cy.js +++ b/test/e2e-cypress/e2e/features/webhooks.cy.js @@ -16,10 +16,12 @@ describe("Render Webhooks Component", () => { }) }) describe("OpenAPI 3.0.x", () => { - const baseUrl = "/?url=/documents/features/webhooks-openAPI31.yaml" + const baseUrl = "/?url=/documents/features/webhooks-openAPI30.yaml" it("should render nothing", () => { cy.visit(baseUrl) - .get(".webhooks") + cy.get('#swagger-ui .information-container') + .should('exist'); + cy.get(".webhooks", {timeout: 0}) .should("not.exist") }) }) From b3401316d58942919e7311a0f711a8bb459ff6cb Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Thu, 30 Oct 2025 12:51:12 +0100 Subject: [PATCH 2/2] fix: prevent webook from crashing in case of openapi 3.0 --- test/e2e-cypress/e2e/features/webhooks.cy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e-cypress/e2e/features/webhooks.cy.js b/test/e2e-cypress/e2e/features/webhooks.cy.js index 1ad14099224..e82d1017a77 100644 --- a/test/e2e-cypress/e2e/features/webhooks.cy.js +++ b/test/e2e-cypress/e2e/features/webhooks.cy.js @@ -19,8 +19,8 @@ describe("Render Webhooks Component", () => { const baseUrl = "/?url=/documents/features/webhooks-openAPI30.yaml" it("should render nothing", () => { cy.visit(baseUrl) - cy.get('#swagger-ui .information-container') - .should('exist'); + cy.get("#swagger-ui .information-container") + .should("exist") cy.get(".webhooks", {timeout: 0}) .should("not.exist") })