cancel
Showing results for 
Search instead for 
Did you mean: 

How to represent a mixed xml node

Visitor

How to represent a mixed xml node

I'm trying to represent a mixed xml node in JSON schema. The mixed node has multiple attributes and text() contents

 

Example:

<desc language="en-US">Description text</desc>

 

I got to here:

"application/xml": {

"schema": {

"type": "object",
"properties": {

"language": {

"type": "string",
"xml": "attribute": true }

},
"#text": {

"type": "string"

}

},

"xml": { "name": "desc" }

 

}

}

 

But the Swagger UI (v3.38.0) generates:

<desc language="string"><#text>string</#text></desc>

 

Is this a bug in the framework and should #text just always be rendered as text(), is there some kind of syntax missing that allows me to be specific about what #text actually is, is there a different way to do this other than #text?

Tags (1)
1 REPLY 1
Moderator

Re: How to represent a mixed xml node

Hi @ahenket,

 

OpenAPI Specification currently does not have a way to represent such elements. See this thread for details:

https://community.smartbear.com/t5/SwaggerHub/Swagger-Definition-object-default-value/m-p/176972/hig...

 


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements