The Swagger 2.0/OpenAPI 2.0 is used to define a set of files required to describe and document of Rest API. This tutorial will show you how to export Swagger 2.0/OpenAPI 2.0 file which API that you want to generate.
First, you need to do some prerequisite steps before you can use the function “Generate Metadata“:
- Create Integration
- Create Inbound/Outbound Interface
- Create MetaData
- Create Repository
- IStructure/Message type add into the interface
How to get message type in Swagger 2.0/OpenAPI 2.0 File Format?
The Swagger 2.0/OpenAPI 2.0 can be generated at three places e.g. in the generic page (the custom link of Integration), the interface details page, and the message type of Repository page.
We pick up one for sample using the inbound interface and having Message Type. Before getting the message type, we need to have a MetaData provider, a Repository.
Here is the Message Type sample:
Inbound interface using with Message Type
Checking structure message type in mapping tool at the left side because we are using an inbound interface.
How to generate Swagger 2.0/OpenAPI 2.0 from Generic Page?
Now you are able to generate MetaData. we will show you how to generate metadata on the generic page (the customs link of Integration Details). Please enter the integration details page and you will able to see the “Generate MetaData“ in the Custom Links section. Please click the Generate MetaData link:
Generate metadata in the new way of Swagger 2.0/OpenAPI 2.0. Please choose the interface name on “Create WSDL For Interface”, Choose Swagger 2.0/OpenAPI 2.0 file format in “Chose a format file”, uncheck the checkbox “As old ways?”, Chose an api name, chose an operation, and click the “Export” button.
You will get a Swagger 2.0/OpenAPI 2.0 file format under the “Outbound Interfaces (Related List)” section. You can download it by clicking the link “View”. You will able to see the file after download in the download folder or download bar chrome browser.
How to generate Swagger 2.0/OpenAPI 2.0 from Interface Details Page?
This is the second way to generate Swagger 2.0/OpenAPI 2.0 format, you can go to Interface Details Page that you want to generate. You will see the “Generate MetaData” button on the header section page. Please click this button to see the pop-up screen.
Please choose Swagger 2.0/OpenAPI 2.0 in the “Chose a format file” picklist and click the “Export” button.
You will get the Swagger 2.0/OpenAPI 2.0 file in the download bar section or you can check on download folder on your local pc.
Here is the result of generating meta from the generic page and interface details page. It will generate the Request message type includes the message Type name and its fields that you have link the message type with this interface.
How to generate Swagger 2.0/OpenAPI 2.0 from Message Type of Repository?
This is the third way to generate Swagger 2.0/OpenAPI 2.0 format from the message type. Please enter the message type section in the repository. Then you will see the “Generate MetaData” Action button in the message type section.
Here is the Rest message type template:
We will show you to export the “Rest Service” message type. Please click the Export MetaData button.
It will pop-up to export metadata, then please choose the Swagger 2.0/OpenAPI 2.0 file format.
You will get the file in the download bar section or you can check on the download folder on your local pc.
Here is the Swagger 2.0/OpenAPI 2.0 file format after generating from Repository.
Finally, you have learned how to generate metadata with a Swagger 2.0/OpenAPI 2.0 file format was in the generic page, Interface details page, and message type.