How do I report a bug?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do I report a bug?
I think I've found a bug.
In our Swagger Hub listing for our API, for “POST /v2/document”, for Properties, Parameters, Datasources, and DataSets (inside Datasources) it’s not doing the Property, … inside it for the request body as application/xml.
For example it has:
<Properties>
<Name>string</Name>
<Value>string</Value>
</Properties>
When it should have:
<Properties>
<Property>
<Name>string</Name>
<Value>string</Value>
</Property>
</Properties>
For application/json it appears to be correct (an array):
"Properties": [
{
"Name": "string",
"Value": "string"
}
],
Is this a bug in my yaml or a bug in SwaggerHub?
Thanks - dave
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dave,
You need to add a couple of XML-specific attributes to the schemas:
1) In Template.Properties, add xml.wrapped=true:
Template:
type: object
properties:
...
Properties:
description: "Windward properties for this document. These override any properties set in the configuration file on the server side."
type: array
items:
$ref: '#/components/schemas/Property'
xml:
wrapped: true
...
2) In the Property schema, add xml.name:
Property:
type: object
description: "A property set at the individual document generation level."
properties:
...
xml:
name: Property
Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That solved it.
Out of curiosity, why is this needed? I would think it would happen automatically.
thanks - dave
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Arrays are not wrapped by default, and XML element names are not inferred for singular/plural forms. This information needs to be added by using the xml keyword.
For more information, please see:
- "XML Object" section of the OpenAPI Specification
- "Wrapping Arrays" section of the Representing XML guide
Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
