forked from swagger-api/swagger-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: coerce multipart initial property values to string (via swagger-…
…api#5166) * coerce multipart initial property values to string * add tests
- Loading branch information
Showing
3 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
openapi: "3.0.0" | ||
|
||
paths: | ||
/: | ||
post: | ||
requestBody: | ||
required: true | ||
content: | ||
multipart/form-data: | ||
schema: | ||
type: object | ||
properties: | ||
first: | ||
type: object | ||
example: | ||
one: abc | ||
two: 123 | ||
second: | ||
type: array | ||
items: | ||
type: string | ||
example: | ||
- "hi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
describe("#5164: multipart property initial values", () => { | ||
it("should provide correct initial values for objects and arrays", () => { | ||
const correctObjectValue = JSON.stringify({ | ||
"one": "abc", | ||
"two": 123 | ||
}, null, 2) | ||
|
||
cy | ||
.visit("?url=/documents/bugs/5164.yaml") | ||
.get("#operations-default-post_") | ||
.click() | ||
.get(".try-out__btn") | ||
.click() | ||
.get(`.parameters[data-property-name="first"] textarea`) | ||
.should("have.value", correctObjectValue) | ||
.get(`.parameters[data-property-name="second"] input`) | ||
.should("have.value", "hi") | ||
}) | ||
}) |