Swagger xml attribute representation
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022
06:08 PM
03-14-2022
06:08 PM
Swagger xml attribute representation
Swagger lacks representing xml with attributes properly. I think the problem is OpenApi only considered key/value pair each element just like JSON.
Is there any plan to fix it.
Example of xml
<MESSAGE att1="Name" att2="DOB"></MESSAGE>
And in Swagger UI 'Try it out' section failed to accept and set the values on attributes of the xml
Is there any plan to fix it.
Example of xml
<MESSAGE att1="Name" att2="DOB"></MESSAGE>
And in Swagger UI 'Try it out' section failed to accept and set the values on attributes of the xml
Labels:
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2022
01:03 AM
03-16-2022
01:03 AM
Hi @WT
XML is supported by OpenAPI, take a look at https://swagger.io/docs/specification/data-models/representing-xml/. Here is your example written down...
openapi: 3.0.3
info:
title: XML Example
description: XML Example
version: "0.1"
paths:
/foo:
post:
requestBody:
content:
application/xml:
schema:
$ref: '#/components/schemas/Message'
responses:
'201':
description: Created
content:
application/xml:
schema:
$ref: '#/components/schemas/Message'
components:
schemas:
Message:
type: object
xml:
name: MESSAGE
properties:
att1:
type: string
example: Name
xml:
attribute: true
att2:
type: string
example: DOB
xml:
attribute: true
