@@ -58,8 +58,9 @@ export const callbacksOperations = onlyOAS3(
|
|||||||
.reduce((allOperations, callback, callbackName) => {
|
.reduce((allOperations, callback, callbackName) => {
|
||||||
if (!Map.isMap(callback)) return allOperations
|
if (!Map.isMap(callback)) return allOperations
|
||||||
|
|
||||||
return callback.reduce((callbackOperations, pathItem, expression) => {
|
const callbackOperations = callback.reduce(
|
||||||
if (!Map.isMap(pathItem)) return callbackOperations
|
(callbackOps, pathItem, expression) => {
|
||||||
|
if (!Map.isMap(pathItem)) return callbackOps
|
||||||
|
|
||||||
const pathItemOperations = pathItem
|
const pathItemOperations = pathItem
|
||||||
.entrySeq()
|
.entrySeq()
|
||||||
@@ -72,8 +73,12 @@ export const callbacksOperations = onlyOAS3(
|
|||||||
specPath: specPath.concat([callbackName, expression, method]),
|
specPath: specPath.concat([callbackName, expression, method]),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
return callbackOperations.concat(pathItemOperations)
|
return callbackOps.concat(pathItemOperations)
|
||||||
}, List())
|
},
|
||||||
|
List()
|
||||||
|
)
|
||||||
|
|
||||||
|
return allOperations.concat(callbackOperations)
|
||||||
}, List())
|
}, List())
|
||||||
.groupBy((operationDTO) => operationDTO.callbackName)
|
.groupBy((operationDTO) => operationDTO.callbackName)
|
||||||
.map((operations) => operations.toArray())
|
.map((operations) => operations.toArray())
|
||||||
|
|||||||
19
test/e2e-cypress/e2e/features/oas3-callbacks.cy.js
Normal file
19
test/e2e-cypress/e2e/features/oas3-callbacks.cy.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Related to // https://github.com/swagger-api/swagger-ui/issues/9222.
|
||||||
|
*/
|
||||||
|
|
||||||
|
describe("OpenAPI 3.0 Callbacks", () => {
|
||||||
|
it("should render all defined callbacks", () => {
|
||||||
|
cy.visit(
|
||||||
|
"/?url=/documents/features/oas3-callbacks.yaml"
|
||||||
|
)
|
||||||
|
.get("#operations-Device-register")
|
||||||
|
.click()
|
||||||
|
.get(".opblock-section-header .tab-item.false")
|
||||||
|
.click()
|
||||||
|
.get("#operations-callbacks-callbackOne")
|
||||||
|
.should("be.visible")
|
||||||
|
.get("#operations-callbacks-callbackTwo")
|
||||||
|
.should("be.visible")
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
openapi: 3.0.0
|
||||||
|
servers: []
|
||||||
|
info:
|
||||||
|
version: "1.0.0"
|
||||||
|
title: home-iot-api
|
||||||
|
description: The API
|
||||||
|
paths:
|
||||||
|
/devices:
|
||||||
|
get:
|
||||||
|
callbacks:
|
||||||
|
callbackOne:
|
||||||
|
'callbackOne':
|
||||||
|
get:
|
||||||
|
operationId: callbackOne
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
$ref: '#/components/schemas/ApiResponse'
|
||||||
|
callbackTwo:
|
||||||
|
'callbackTwo':
|
||||||
|
get:
|
||||||
|
operationId: callbackTwo
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
$ref: '#/components/schemas/ApiResponse'
|
||||||
|
tags:
|
||||||
|
- Device
|
||||||
|
operationId: register
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: successfully registered device
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
ApiResponse:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
example: everything is ok
|
||||||
Reference in New Issue
Block a user