Forum Discussion

blackwj's avatar
blackwj
New Contributor
6 years ago
Solved

Swagger Definition object default value

I'm building a swagger json definitiion for the below xml payload to use within the Swagger UI. Once complete I'll convert it to yaml and import the definition into Swagger UI. I'm having an issue fi...
  • HKosova's avatar
    6 years ago

    Hi blackwj,

     

    I'm afraid the OpenAPI Specification currently has no way to represent XML elements with attributes such as

    <elem attr="value">Some text</elem>

     

    Currently, attributes can only be defined for objects such as

    <obj attr="value">
      <elem>Some text</elem>
    </obj>

    but not for simple <elem>text</elem> elements.

     

    There's an open issue about this limitation in the OpenAPI Specification repository:

    How to represent XML elements with attributes

     

    OpenAPI Specification maintainers are considering an option to use alternative data modeling schemas (for example, XSD Schema), so your use case might be supported in a future version of OpenAPI.