Skip to content

Commit e1ad309

Browse files
fix: prevent webook from crashing in case of openapi 3.0 (#10623)
* fix: prevent webook from crashing in case of openapi 3.0
1 parent 9c1e769 commit e1ad309

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/core/plugins/oas31/components/webhooks.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { List } from "immutable"
77

88
const Webhooks = ({ specSelectors, getComponent }) => {
99
const operationDTOs = specSelectors.selectWebhooksOperations()
10+
if (!operationDTOs) {
11+
return null
12+
}
1013
const pathItemNames = Object.keys(operationDTOs)
1114

1215
const OperationContainer = getComponent("OperationContainer", true)

test/e2e-cypress/e2e/features/webhooks.cy.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ describe("Render Webhooks Component", () => {
1616
})
1717
})
1818
describe("OpenAPI 3.0.x", () => {
19-
const baseUrl = "/?url=/documents/features/webhooks-openAPI31.yaml"
19+
const baseUrl = "/?url=/documents/features/webhooks-openAPI30.yaml"
2020
it("should render nothing", () => {
2121
cy.visit(baseUrl)
22-
.get(".webhooks")
22+
cy.get("#swagger-ui .information-container")
23+
.should("exist")
24+
cy.get(".webhooks", {timeout: 0})
2325
.should("not.exist")
2426
})
2527
})

0 commit comments

Comments
 (0)