swagger-api / swagger-api/swagger-ui
xml example cannot be generated for response type of array
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: Windows 10
- Browser: Firefox, Chrome, Edge
- Method of installation: npm
- Swagger-UI version: 3.11.0
- Swagger/OpenAPI version: Swagger 2.0
Content & configuration
I've reproduced this locally, but even easier to demonstrate, petstore has the same issue.
Example Swagger/OpenAPI definition:
https://generator.swagger.io/api/swagger.json
snippet from swagger.json
responses:
200:
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/Pet"
Describe the bug you're encountering
In swagger ui, when you have a GET that has a response that is a list, and you selected content type of xml, the Example Value has an error "XML example cannot be generated".
To reproduce...
Steps to reproduce the behavior:
- Go to https://editor.swagger.io
- Expand /pet/findByStatus
- Make sure Response content type is application/xml
- Example Value for status code 200 has "XML example cannot be generated"
Expected behavior
I would expect to see the example xml for the response.
Screenshots

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the problem in Swagger UI using the Swagger 2.0 definition at generator.swagger.io/api/swagger.json, then expand /pet/findByStatus in editor.swagger.io with application/xml selected. Trace the example generation path for the array response and compare it with the expected XML example; done means the Example Value no longer shows "XML example cannot be generated".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100