SAP Integration Suite – “Settings” for Message Mapping
SAP Cloud Integration version 6.27.**, one of the capabilities of SAP Integration Suite, comes with support of “Settings” in Message Mapping artifact.
This enables integration flow developer on OpenAPI Spec JSON message mapping to configure on how to handle to basic type (basic data type) when the OpenAPI Spec JSON is used in the target mapping schema.
SAP Cloud Integration version 6.27.** software update is planned on end of May 2022 or beginning of June 2022 (date subjected to change).
Limitation: Currently, when there is a message mapping with source as XML Schema and target as OpenAPI Spec JSON, when target JSON schema has basic type as, e.g., Boolean, in runtime if a source value comes-in as false, the target JSON output payload’s value becomes “false”, treating it as a string.
Through this settings feature, this limitation has been fixed.
Below is a screenshot of mapping settings.
Settings button in message mapping editor
By default, the first radio button is selected, it is just to support the existing mappings which already producing the string content in the target JSON payload, e.g. where users might have might have created a work around with some means to remove quotes from the String value. This settings is not only meant for Boolean, but other JSON basic types, like integer, number, would also be considered
Note: Introduction of this setting’s default selection to first radio button for the OpenAPI spec JSON (in source) to OpenAPI Spec JSON (in target) mappings, will not hamper the currently built mappings. In JSON to JSON mapping, if source has value of false, the same is assigned to target node and if a source value has “false”, again the same is assigned to target. If you wish the target node value should adhere to JSON basic type, then 2nd radio button configuration can be selected.
Let’s check on how it impacts the OpenAPI Spec JSON output in message mapping. Consider below message mapping and integration flow where the message mapping is defined.
The above message mapping has source schema as XSD and target schema as OpenAPI Spec JSON
Sample Integration Flow which consume above message mapping
Let the Mapping Settings be at default 1st radio button (as in the above Mapping Settings dialog)
Let’s simulate this integration flow by adding simulation start and end points as below
Click on the simulation start button, which opens up a dialog. Enter/upload the test payload in body section as show in below screenshot
Click on Run Simulation, on the integration flow simulation section
Once simulation completes, select the envelop icon at simulation end point on the sequence connector, which opens up the properties, check the Body section, as shown in sample screenshot below
As we can observe in above image highlighted sections, the values of numberType, booleanType and integerType are enclosed with quotes, making them as string values. It is the default and existing behaviour as mentioned in Limitation section above.
Open the mapping editor again, change the settings to 2nd radio as shown in below screenshot. Click on OK in the dialog and OK in the mapping editor to save the changes.
Now, reset/clear the integration flow simulation (clear simulation screenshot below),
Repeat the steps of adding start and end simulation, and uploading the test payload and run simulation. After simulation completes, check the output as per the screenshot below.
As we can observe in above image highlighted sections, the values of numberType, booleanType and integerType are not with quotes but parsed as per their basic types, which fixes the above mentioned limitation in Limitation section.
As next step, this settings will be extended to handle the behaviour of source value’s having empty and null content at complete mapping level. I will keep this blog updated once we release this next increment.