Skip to content

How to represent XML elements with attributes #630

Open
@micovery

Description

@micovery

Suppose I have the following XML:

<location>
  <coordinate format="lat-lon">a-b</coordinate>
</location>

I this the correct way to represent this using Swagger Schema objects?

---
  type: "object"
  xml: 
    name: "location"
  properties: 
    coordinate: 
      type: "string"
      properties: 
        format: 
          type: "string"
          xml: 
            attribute: true

It seems weird for the "coordinate" property ... which itself is of type "string" to contain a "properties" field. Coming from JSON-Schema-Draft-V4 background, you would not expect a "string" field to have properties, because there is no such thing in JSON.

But then again, this is a "Swagger Schema Object" ... not a JSON-Schema-Draft-V4. I just want confirmation whether or not this is the correct way to do it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    media and encodingIssues regarding media type support and how to encode data (outside of query/path params)xml

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions