swagger-api / swagger-api/swagger-ui
Example for Wrapped Xml array elements is generated incorrectly
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
SwaggerUI 3.11.0
This issue was reported previously and resolved, but seems it's back:
#2577
| Q | A |
|---|---|
| Bug or feature request? | Bug |
| Which Swagger/OpenAPI version? | Tried both 2.0 and OpenApi 3.0 |
| Which Swagger-UI version? | 3.11.0 |
| How did you install Swagger-UI? | Hosted on my local machine |
| Which browser & version? | Chrome 63.0 |
| Which operating system? | Windows 10 |
Demonstration API definition
https://integration.test-freightos.com/api-docs/docs-aggregator/lufthansa/Availability
My use case:
...
"masterConsignments": {
"xml": {
"wrapped": true
},
"type": "array",
"items": {
"xml": {
"name": "masterConsignment"
},
"$ref": "#/components/schemas/AvailabilityMasterConsignmentReq"
}
}
...
Actual example output:
<masterConsignments>
<masterConsignments>
<product>
....
</product>
</masterConsignments>
</masterConsignments>
Expected example output:
<masterConsignments>
<masterConsignment>
<product>
....
</product>
</masterConsignment>
</masterConsignments>
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
Start by reproducing the XML example generation with the linked Demonstration API definition and the wrapped masterConsignments array. Inspect the example-generation path for wrapped XML arrays; done when the wrapper remains masterConsignments while each item uses the XML name masterConsignment, for both the shown OpenAPI 2.0 and 3.0 cases.
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
- 45/100