This documentation is for WSO2 Enterprise Integrator version 6.1.1 . View documentation for the latest release.

All docs This doc
||
Skip to end of metadata
Go to start of metadata

You need to have two input and output JSON Schema files for a Data Mapping configuration as shown in the example below.

example mapping configuration

Therefore, you can use the WSO2 Data Mapper Diagram Editor to create a JSON Schema manually by adding elements to the Data Mapper tree view as explained below.  

Components of a JSON Schema

There are the following four types of components in a JSON Schema:

  • Arrays
  • Objects
  • Fields
  • Attributes

Adding the root element

When creating the tree you need to first add the root element. The root element can be either an object or an array. Right-click on the Input or Output box and then click Add new Root Element as shown below, to add the root element.

select add new root element option

Add the following details to create the root element.

  • Name: name of the root element
  • Schema Type: type of the element (i.e. array or object)
  • ID: ID of the root element to uniquely identify it
  • isNullable: whether the element can be a nullable (i.e. not available in the payload (optional)
    Namespaces: prefix and URL of the namespace (optional)
  • Required: child elements required to be there in the payload (optional)
  • Schema Value: custom URI of the Schema

enter details of the root element

You view the root element added to the Input box as shown below.


Adding a child element

You can add Arrays, Objects, Fields and Attributes as child elements as explained below.

Right-click on the parent element and click Add new Object, to add an Object as shown below.

add an object as a child element

Add the following details to create an Object as a child element.

  • Name: name of the child element
  • Schema Type: type of the element (i.e. object)
  • ID: ID of the child element to uniquely identify it
  • isNullable: whether the element can be a nullable (i.e. not available in the payload (optional)
    Namespaces: prefix and URL of the namespace (optional)
  • Required: child elements required to be there in the payload (optional)
  • Schema Value: custom URI of the Schema

    If the object has element identifiers, then select the checkbox and add the value, type, and URL of the identifier.

  • Object holds a value: if the object holds a value or not

    If the object holds a value, then select the checkbox and select the data type.

details to add an object child element

You view the child Object element added to the root element as shown below.

 

The element identifier is added as an attribute to the element.


child element added to Input box

Right-click on the parent element and click Add new Array, to add an Array as shown below.

adding an array as a child element 

You need to add the following details to create an Array as a child element.

  • Name: name of the child element
  • Schema Type: type of the element (i.e. array)
  • ID: ID of the child element to uniquely identify it
  • isNullable: whether the element can be a nullable (i.e. not available in the payload (optional)
    Namespaces: prefix and URL of the namespace (optional)
  • Required: child elements required to be there in the payload (optional)
  • Schema Value: custom URI of the Schema

    If the array has element identifiers, then select the checkbox and add the value, type, and URL of the identifier.

  • Object holds a value: if the object holds a value or not

    If the array holds a value, then select the checkbox and select the data type.

entering details to add the Array child element

You view the child Array element added to the root element as shown below.

The element identifier is added as an attribute to the element.

Right-click on the parent element and click Add new Field, to add a Field as shown below.

add Field child element

You need to add the following details to create a Field as a child element.

  • Name: name of the child element
  • Schema Type: type of the element
  • ID: ID of the child element to uniquely identify it
  • isNullable: whether the element can be a nullable (i.e. not available in the payload (optional)
    Namespaces: prefix and URL of the namespace (optional)
  • Required: child elements required to be there in the payload (optional)
  • Schema Value: custom URI of the Schema

entering details to add field child element

You view the child Field element added to the root element as shown below.

added field element

Right-click on the parent element and click Add new Attribute, to add an attribute as shown below.

add Attribute child element

You need to add the following details to create an Attribute as a child element.

  • Name: name of the child element
  • Schema Type: type of the element
  • ID: ID of the child element to uniquely identify it
  • isNullable: whether the element can be a nullable (i.e. not available in the payload (optional)
    Namespaces: prefix and URL of the namespace (optional)
  • Required: child elements required to be there in the payload (optional)
  • Schema Value: custom URI of the Schema

entering details to add attribute child element

You view the child Attribute element added to the root element as shown below.

attribute added to root element

Setting a nullable element

You can set an element as a nullable element, so that it is not required to have that element in the payload. Right-click on the parent element and click Enable Nullable, to enable an element to make it nullable as shown below.

enable nullable element

Right-click on the parent element and click Disable Nullable, to make it required in the payload as shown below.

disable the element being nullable

Editing an element 

Right-click on any element and click Edit Object, to edit and update the field values as required as shown below.

edit an element

Deleting an element 

Right-click on any element and click Delete from Model, to delete it as shown below.

This deletes the element with its child nodes.

deleting an element

 

  • No labels