6

SAP Cloud Integration – Swagger/OpenAPI Spec JSON ... - SAP Community

 7 months ago
source link: https://community.sap.com/t5/technology-blogs-by-sap/sap-cloud-integration-swagger-openapi-spec-json-in-message-mapping/ba-p/13475829
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Introduction

SAP Cloud Integration version 3.30.**/ 4.17.** comes with an enhancements/feature for message mapping where in you can upload and map the Swagger/Open API Spec JSON file. This blog describes about this new enhancement.

Swagger/Open API Spec JSON

When we say Swagger/Open API Spec JSON, we are supporting the JSON files based on OpenAPI Spec 2.0 and 3.0 version and especially the JSON definition files of the REST APIs hosted on https://api.sap.com . For a given REST API, you can download the definition file of the same as shown in the screenshot below. Here a JSON specification file of an Ariba REST API is used.
JM-1.png

Ariba Asset Management API on SAP API Hub

JM-2-1.png

Click on Download API Specification -> JSON

JM-Blog-3.png

JSON File Downloaded

Once you download the Swagger JSON, you can use it in your message mapping. To use this feature, you need Message Mapping flow step version 1.1. When you drag and drop the message mapping flow step of the said SAP Cloud Integration version, it will be of the latest one, i.e. version 1.1.

Below are the screenshot on how to see a flow step version.
JM-Blog-6.png

Click on (i) icon

JM-Blog-7.png

Version number of the flow step

You can upload this JSON file similar to other currently supported XSD, WSDL or EDMX file. Just click on source OR target part of the message mapping an upload it. Below sequence of screenshots shows the different UI screens you see once you select and upload the swagger JSON file.
JM-Blog-4.png

Search and add Message Mapping Flow step after click (+) on Content Modifier

JM-Blog-5.png

Click on Create icon/speed button

JM-8.png

Provide a name for the message mapping

JM-9.png

Mapping Editor Opens up -> Add source message

JM-11.png

Upload the downloaded JSON file

JM-12.png

Select API Path

JM-13.png
JM-14.png
JM-15.png
JM-16.png

Source structure in Mapping

JM-17.png

Upload the target structure and define mapping

All the standard functions, along with Groovy script based custom functions/user defined functions (UDFs) of the mapping expression editor are supported for the uploaded swagger JSON. You can use these functions for your mapping definition needs.

You can upload other supported file as well in combination with JSON. That is, JSON file at the source side and a WSDL file at the target side (or vice versa) of the message mapping as per your integration scenario needs.

Further, you can complete the message mapping and/or integration flow development as usual and deploy, run the integration scenario.

Planned Enhancements

Below topics are planned for the future enhancements.

JSON Schema as per https://json-schema.org/

As of now, only swagger JSON files are supported, and going forward we will be working on the provide the support for JSON files which adhere to the specifications as defined in https://json-schema.org/. This shall come handy when you have a JSON structure for other kind/third party systems of integrations which understands JSON data files/payloads adhering to said spec.

Multi Mapping

Currently, the Swagger JSON is not supported in multi mapping. In feature increments we will be working on to enable it.

Summary

Support of swagger JSON will now enable you to develop the integration scenarios, which probably pure JSON based scenarios communicating with REST APIs without the need of JSON <-> XML converter steps which were previously mandatorily required because message mappings were able to only understand XML payloads. Now can you avoid JSON <-> XML converter steps for such scenarios.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK