bug: parameter allowEmptyValue + required interactions (via #5142)
* add failing tests
* standardize parameter keying
* validateParam test migrations
* migrate test cases to new pattern
* disambiguate name/in ordering in `body.body` test cases
* `name+in`=> `{in}.{name}`
* consider allowEmptyValue parameter inclusion in runtime validation
* use config object for all validateParam options
* drop isXml flag from validateParams
This commit is contained in:
26
test/e2e-cypress/static/documents/bugs/5129.yaml
Normal file
26
test/e2e-cypress/static/documents/bugs/5129.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
openapi: "3.0.0"
|
||||
|
||||
paths:
|
||||
/aev:
|
||||
get:
|
||||
parameters:
|
||||
- name: param
|
||||
in: query
|
||||
allowEmptyValue: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: ok
|
||||
/aev/and/required:
|
||||
get:
|
||||
parameters:
|
||||
- name: param
|
||||
in: query
|
||||
allowEmptyValue: true
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: ok
|
||||
121
test/e2e-cypress/tests/bugs/5129.js
Normal file
121
test/e2e-cypress/tests/bugs/5129.js
Normal file
@@ -0,0 +1,121 @@
|
||||
describe("#5129: parameter required + allowEmptyValue interactions", () => {
|
||||
describe("allowEmptyValue parameter", () => {
|
||||
const opId = "#operations-default-get_aev"
|
||||
it("should omit the parameter by default", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev")
|
||||
})
|
||||
it("should include a value", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(`.parameters-col_description input[type=text]`)
|
||||
.type("asdf")
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev?param=asdf")
|
||||
})
|
||||
it("should include an empty value when empty value box is checked", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(`.parameters-col_description input[type=checkbox]`)
|
||||
.check()
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev?param=")
|
||||
})
|
||||
it("should include a value when empty value box is checked and then input is provided", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(`.parameters-col_description input[type=checkbox]`)
|
||||
.check()
|
||||
.get(`.parameters-col_description input[type=text]`)
|
||||
.type("1234")
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev?param=1234")
|
||||
})
|
||||
})
|
||||
describe("allowEmptyValue + required parameter", () => {
|
||||
const opId = "#operations-default-get_aev_and_required"
|
||||
it("should refuse to execute by default", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.wait(1000)
|
||||
.get(".request-url pre")
|
||||
.should("not.exist")
|
||||
})
|
||||
it("should include a value", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(`.parameters-col_description input[type=text]`)
|
||||
.type("asdf")
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev/and/required?param=asdf")
|
||||
})
|
||||
it("should include an empty value when empty value box is checked", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(`.parameters-col_description input[type=checkbox]`)
|
||||
.check()
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev/and/required?param=")
|
||||
})
|
||||
it("should include a value when empty value box is checked and then input is provided", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(`.parameters-col_description input[type=checkbox]`)
|
||||
.check()
|
||||
.get(`.parameters-col_description input[type=text]`)
|
||||
.type("1234")
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev/and/required?param=1234")
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user