Table of Contents

Search

  1. Preface
  2. Introduction to REST V2 Connector
  3. Connections for REST V2
  4. REST V2 operations
  5. Mappings and mapping tasks with REST V2 Connector
  6. Swagger File Generation
  7. Appendix A: Swagger objects
  8. OpenAPI objects

REST V2 Connector

REST V2 Connector

XML objects in swagger specification

XML objects in swagger specification

You can configure XML objects such as XML attributes, the wrapper object, and the namespace object in the swagger specification file.
You can define attributes only for XML objects. You cannot define attributes for XML elements. You can use wrapper objects for a simple type array element only when the array element has inline definitions. Use qualified and unqualified namespace objects in response for source, midstream, and target transformations and in request for midstream and target transformations.
An XML attribute is always of type string. Even if the swagger definition has attribute with type as number, REST V2 Connector always treats the attribute as string. The XSD generated contains the data type as string for the XML attribute.
Ensure that the Swagger definition does not contain multiple namespaces.
Swagger definition for an XML attribute:
"XMLAttrArray_Request##body##Employee##dep##Mangr" : {
"properties" : {
"desg" : {
"type" : "string",
"xml": { "attribute": true }
}, "mid" : { "type" : "string" },
XML attribute sample:
<dep>
<Mangr desg="Director">
<mid>em09</mid>
<mname>mg</mname>
</Mangr>
<id>did</id>
<name>dname</name>
</dep>
Swagger definition for a Wrapper object:
"books" : {
"type" : "array",
"items" : { "type" : "string" },
"xml": {
"wrapped" : "true", "name": "books-array"
}
}
Wrapper object sample:
<books-array>
<books>1</books>
<books>2</books>
</books-array>
Swagger definition for a Namespace object:
root" : {
"properties" : {
"table" : {
"$ref" : "#/definitions/NSResReq_Request##body##root##table"
}
},
"xml":{
"prefix": "h",
"namespace": "http://www.w3.org/TR/html4/"
}
}
Namespace object sample:
<h:root xmlns:h="http://www.w3.org/TR/html4/">
<table>
<tr>
<td>Apples</td>
<td>Bananas</td>
</tr>
</table>
</h:root>

0 COMMENTS

We’d like to hear from you!