fix: Callback component $$ref handling (#4454)
This commit is contained in:
@@ -16,8 +16,14 @@ const Callbacks = (props) => {
|
||||
return <div key={callbackName}>
|
||||
<h2>{callbackName}</h2>
|
||||
{ callback.map((pathItem, pathItemName) => {
|
||||
if(pathItemName === "$$ref") {
|
||||
return null
|
||||
}
|
||||
return <div key={pathItemName}>
|
||||
{ pathItem.map((operation, method) => {
|
||||
if(method === "$$ref") {
|
||||
return null
|
||||
}
|
||||
let op = fromJS({
|
||||
operation
|
||||
})
|
||||
|
||||
32
test/e2e/scenarios/bugs/4445.js
Normal file
32
test/e2e/scenarios/bugs/4445.js
Normal file
@@ -0,0 +1,32 @@
|
||||
describe("bug #4445: callback-via-$ref rendering", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input", 5000)
|
||||
.pause(5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4445.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("expands an operation that has a visible callback", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock-body", 5000)
|
||||
.click(".opblock-section-header > .tab-header > div.tab-item:nth-of-type(2)")
|
||||
.waitForElementVisible(".callbacks-container .opblock", 5000)
|
||||
.click(".callbacks-container .opblock")
|
||||
.waitForElementVisible(".callbacks-container .opblock-body", 5000)
|
||||
.assert.containsText(".callbacks-container .opblock-description-wrapper:nth-of-type(2) p", "subscription payload")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
64
test/e2e/specs/bugs/4445.yaml
Normal file
64
test/e2e/specs/bugs/4445.yaml
Normal file
@@ -0,0 +1,64 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: Callback Example
|
||||
version: 1.0.0
|
||||
paths:
|
||||
/streams:
|
||||
post:
|
||||
description: subscribes a client to receive out-of-band data
|
||||
parameters:
|
||||
- name: callbackUrl
|
||||
in: query
|
||||
required: true
|
||||
description: |
|
||||
the location where data will be sent. Must be network accessible
|
||||
by the source server
|
||||
schema:
|
||||
type: string
|
||||
format: uri
|
||||
example: https://tonys-server.com
|
||||
responses:
|
||||
'201':
|
||||
description: subscription successfully created
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
description: subscription information
|
||||
required:
|
||||
- subscriptionId
|
||||
properties:
|
||||
subscriptionId:
|
||||
description: this unique identifier allows management of the subscription
|
||||
type: string
|
||||
example: 2531329f-fb09-4ef7-887e-84e648214436
|
||||
callbacks:
|
||||
# the name `onData` is a convenience locator
|
||||
onData:
|
||||
$ref: '#/components/callbacks/onData'
|
||||
components:
|
||||
callbacks:
|
||||
onData:
|
||||
# when data is sent, it will be sent to the `callbackUrl` provided
|
||||
# when making the subscription PLUS the suffix `/data`
|
||||
'{$request.query.callbackUrl}/data':
|
||||
post:
|
||||
requestBody:
|
||||
description: subscription payload
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
timestamp:
|
||||
type: string
|
||||
format: date-time
|
||||
userData:
|
||||
type: string
|
||||
responses:
|
||||
'202':
|
||||
description: |
|
||||
Your server implementation should return this HTTP status code
|
||||
if the data was received successfully
|
||||
'204':
|
||||
description: |
|
||||
Your server should return this HTTP status code if no longer interested
|
||||
in further updates
|
||||
Reference in New Issue
Block a user