Speakeasy Logo
Skip to Content

XML Object in OpenAPI

The XML Object allows us to add details about how the schema should be represented as XML.

This is useful because XML has different data types and structures compared to JSON.

For example, in JSON, an array is a list of values only, while in XML, array values are represented as elements with names.

Field
Type
String
Required
Description
The name of the element when the property is represented in XML. When used in
, the name applies to each element in the XML array.
Type
String
Required
Description
The absolute URL of the XML namespace.
Type
String
Required
Description
A prefix for the element's name.
Type
Boolean
Required
Description
Whether the property should be represented as an XML attribute (
) instead of an XML element (
). Defaults to
, so each property is represented as an element by default.
Type
Boolean
Required
Description
Whether array elements should be wrapped in a container element. Defaults to
, so array elements are not wrapped by default. Only applies to arrays.
Required
Description
Any number of extension fields can be added to the XML object that can be used by tooling and vendors.

The examples below illustrate how XML Objects can be used:

The example above translates to the following XML example:

Last updated on