feature: support for Parameter.content (#5571)
* add `getParameterSchema` OAS helper * use `Parameter.content.[firstKey].schema` as schema value when present * `newValue` -> `initialValue` * make `paramWithMeta` a const * add trailing comma to `swagger2SchemaKeys` * refactor `helpers` to a folder * deprecate `src/core/utils.js` in favor of `src/core/helpers/` * support `Parameter.content.[mediaType].schema` in validateParam * reject `null` as an OAS3 object value * expose Fetch errors in the browser console * generate ParameterRow default values based on `content` values * add tests for `getParameterSchema` * remove debugger statement * remove debugger statement * don't apply `generatedSampleValue`s to parameters with `examples` * remove extra semi * disable JSON check in parameter runtime validation * stringify JsonSchema_object textarea values * add Cypress tests * swagger-client@3.9.4
This commit is contained in:
37
test/e2e-cypress/tests/bugs/4442.js
Normal file
37
test/e2e-cypress/tests/bugs/4442.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
describe("UI #4442: Parameter.content display and execution", function() {
|
||||
it("should display textareas as static documentation according to the `example`", () => {
|
||||
cy.visit("/?url=/documents/bugs/4442.yaml")
|
||||
.get(`#operations-default-get_`)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(
|
||||
`div.json-schema-array > div:nth-child(1) > div > textarea`
|
||||
)
|
||||
.should("have.value", `{\n "userId": 1,\n "currency": "USD"\n}`)
|
||||
.get(
|
||||
`div.json-schema-array > div:nth-child(2) > div > textarea`
|
||||
)
|
||||
.should("have.value", `{\n "userId": 2,\n "currency": "CAD"\n}`)
|
||||
})
|
||||
it("should serialize JSON into a query correctly", () => {
|
||||
cy.visit("/?url=/documents/bugs/4442.yaml")
|
||||
.get(`#operations-default-get_`)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should(
|
||||
"have.text",
|
||||
`http://localhost:3230/?users=${encodeURIComponent(
|
||||
`[{"userId":1,"currency":"USD"},{"userId":2,"currency":"CAD"}]`
|
||||
)}`
|
||||
)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user