Forum Discussion

newtoswagger's avatar
newtoswagger
Frequent Visitor
5 years ago

swagger code-gen ignoring xml-attributes for application/xml request

Hi All,

 

I am new to using Swagger. 

I am trying to generate swagger server side code with the help of swagger editor. I created the below xml request using swagger editor(json).

<?xml version="1.0" encoding="UTF-8"?>
<request>
<tag1></tag1>
<tag2></tag2>
<tag3/>
<params>
<param key="test"></param>
<param key="test1"></param>
<param key="test2"></param>
</params>
</request>

 

 

But when i generated the server side project using the "Generate Server" option with language as spring using this swagger editor(json) and ran the project in ide. I get the below sample xml request in the swagger UI.

 

<?xml version="1.0" encoding="UTF-8"?>
<request>
<tag1></tag1>
<tag2></tag2>
<tag3></tag3>
<params>
<test>
<key></key>
</test>
<test1>
<key></key>
</test1>
<test2>
<key>l</key>
</test2>
</params>
</request>

 

I observed that the "xml": {"attribute": true} tag is being ignored and hence this resultant request is being generated in the swagger UI. Can someone please assist on how to resolve this?

No RepliesBe the first to reply