swagger-api / swagger-api/swagger-codegen
xml:attribute on a response property defined inline improperly renders as an element in the XML example output
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When defining a response property inline with the xml:attribute value set to true, the XML example output improperly renders the property as an element instead of an attribute. Note that when the response property is defined in the "definitions" section, the xml:attribute value works as expected and renders the item properly as an attribute.
Swagger-codegen version
master
Swagger declaration file content or url
swagger: '2.0'
info:
title: 'inline xml:attribute issue'
version: '1'
definitions:
'response':
type: object
xml:
name: 'test'
properties:
'attribute':
type: string
example: 'value'
xml:
attribute: true
'element':
type: string
example: 'value'
paths:
'/defined-response':
get:
produces: [ 'application/xml' ]
responses:
200:
description: Success
schema:
$ref: '#/definitions/response'
'/inline-response':
get:
produces: [ 'application/xml' ]
responses:
200:
description: Success
schema:
type: object
xml:
name: 'test'
properties:
'attribute':
type: string
example: 'value'
xml:
attribute: true
'element':
type: string
example: 'value'
Command line used for generation
Generate any docs that show the XML example output.
Steps to reproduce
Generate any docs that show the XML example output and the output for two paths in the example will be:
/defined-response - works - The "attribute" property is properly rendered as an attribute of the parent:
<test attribute="value">
<element>value</element>
</test>
/inline-response - does not work - The "attribute" property is incorrectly rendered as an element of the parent:
<test>
<attribute>value</attribute>
<element>value</element>
</test>
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
Use the Swagger declaration in the issue as the reproduction input and generate documentation containing XML example output for both response definitions. Compare the defined-response and inline-response cases; done means the inline response renders attribute="value" on , matching the referenced definition, with a regression check for both outputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- xml
- Domain
- documentation, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100