fix: tolerate callback parameter values in ParameterRow (via #4873)
* fix: tolerate callback parameter values in ParameterRow * Update 4867.js
This commit is contained in:
@@ -31,7 +31,7 @@ export default class ParameterRow extends Component {
|
||||
let { specSelectors, pathMethod, rawParam } = props
|
||||
let { isOAS3 } = specSelectors
|
||||
|
||||
let parameterWithMeta = specSelectors.parameterWithMetaByIdentity(pathMethod, rawParam)
|
||||
let parameterWithMeta = specSelectors.parameterWithMetaByIdentity(pathMethod, rawParam) || new Map()
|
||||
// fallback, if the meta lookup fails
|
||||
parameterWithMeta = parameterWithMeta.isEmpty() ? rawParam : parameterWithMeta
|
||||
|
||||
@@ -87,7 +87,7 @@ export default class ParameterRow extends Component {
|
||||
let paramWithMeta = specSelectors.parameterWithMetaByIdentity(pathMethod, rawParam)
|
||||
|
||||
|
||||
if (paramWithMeta.get("value") !== undefined) {
|
||||
if (!paramWithMeta || paramWithMeta.get("value") !== undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -117,6 +117,10 @@ export default class ParameterRow extends Component {
|
||||
|
||||
const { showExtensions, showCommonExtensions } = getConfigs()
|
||||
|
||||
if(!param) {
|
||||
param = rawParam
|
||||
}
|
||||
|
||||
// const onChangeWrapper = (value) => onChange(param, value)
|
||||
const JsonSchemaForm = getComponent("JsonSchemaForm")
|
||||
const ParamBody = getComponent("ParamBody")
|
||||
|
||||
24
test/e2e-cypress/static/documents/bugs/4867.yaml
Normal file
24
test/e2e-cypress/static/documents/bugs/4867.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
title: test
|
||||
version: "0.1"
|
||||
paths:
|
||||
/test:
|
||||
post:
|
||||
operationId: myOp
|
||||
responses:
|
||||
default:
|
||||
description: ok
|
||||
callbacks:
|
||||
subscription:
|
||||
http://$request.query.url:
|
||||
post:
|
||||
description: myCallback
|
||||
parameters:
|
||||
- name: myParam
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
default:
|
||||
description: ok
|
||||
17
test/e2e-cypress/tests/bugs/4867.js
Normal file
17
test/e2e-cypress/tests/bugs/4867.js
Normal file
@@ -0,0 +1,17 @@
|
||||
describe("#4867: callback parameter rendering", () => {
|
||||
it("should render parameters correctly", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/4867.yaml")
|
||||
.get("#operations-default-myOp")
|
||||
.click()
|
||||
.contains("Callbacks")
|
||||
.click()
|
||||
|
||||
.get(".callbacks-container")
|
||||
.contains("http://$request.query.url")
|
||||
.click()
|
||||
|
||||
.get(".parameters-container")
|
||||
.contains("myParam")
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user