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(xml): example generation if an array has an example
ref: swagger-api#6627
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 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,41 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: XML array schema with array-level example | ||
version: 1.0.0 | ||
|
||
paths: | ||
/users: | ||
get: | ||
responses: | ||
"200": | ||
description: '' | ||
content: | ||
application/xml: | ||
schema: | ||
$ref: '#/components/schemas/Users' | ||
|
||
components: | ||
schemas: | ||
Users: | ||
type: array | ||
example: | ||
- id: 123 | ||
name: bob | ||
- id: 456 | ||
name: jane | ||
xml: | ||
name: Users | ||
wrapped: true | ||
items: | ||
type: object | ||
xml: | ||
name: User | ||
properties: | ||
id: | ||
type: integer | ||
xml: | ||
attribute: true | ||
name: | ||
type: string | ||
xml: | ||
attribute: true |
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,11 @@ | ||
describe("#6627: XML example when defined as array", () => { | ||
it("should render xml like json", () => { | ||
const expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Users>\n\t<User id=\"123\" name=\"bob\">\n\t</User>\n\t<User id=\"456\" name=\"jane\">\n\t</User>\n</Users>" | ||
cy | ||
.visit("/?url=/documents/bugs/6627.yaml") | ||
.get("#operations-default-get_users") | ||
.click() | ||
.get(".microlight") | ||
.contains(expected) | ||
}) | ||
}) |