MuleSoft With OpenAPI Specification

MuleSoft With OpenAPI Specification

MuleSoft provides RESTful API Modeling Language (RAML), which makes it easy to manage the whole API lifecycle from design to sharing. Enterprises saw the benefits of RAML’s API-spec-centric approach, and the industry has since incorporated it...

MuleSoft provides RESTful API Modeling Language (RAML), which makes it easy to manage the whole API lifecycle from design to sharing. Enterprises saw the benefits of RAML’s API-spec-centric approach, and the industry has since incorporated it broadly.

To get in-Depth knowledge on MuleSoft you can enroll for live MuleSoft Online Training

MuleSoft recently joined the OpenAPI Initiative of the Linux Foundation, and now MuleSoft’s Anypoint Platform explicitly supports OAS (OpenAPI Specification, formerly Swagger) for describing APIs. MuleSoft Design Center supports importing an OAS 2.0 specification in JSON or ZIP format from the file system. We can also import an OAS 2.0 specification from the internet.

In this article, we will demonstrate how we can use OAS 2.0 API Specification in MuleSoft for API design and implementations.

Let’s get started. First, we will use SwaggerHub (https://app.swaggerhub.com) to create our API Specification using OAS 2.0.

This is image title

As shown in the above screen resource, “/persons/{personId}” has been created on the HTTP GET method to get the details of a particular person. There are two parameters has been defined in the spec, “personId” as URI parameter and "clientid" as a header parameter. As part of the service response, we have created schemas for both success and error scenarios.

In the SwaggerHub UI, we will validate the specification and do the mock testing on the API specification. Once the API specification gets validated and looks good, let’s download the API specification from SwaggerHub, as shown in the above screen.

Now, we will use the downloaded OAS 2.0 API specification in MuleSoft Design Center.

Let's create a new API Specification in Mule Design Center and import the API specification, as shown in the below screen. Here we can import the OAS specification as a file or zip or from a URL.

This is image title

Let’s browse the zip file which we downloaded from SwaggerHub and finish the import. The converted OAS code appears in RAML in the editor panel, as shown in below screen.

This is image title

Please beware, there are some limitations and issues in this OAS to RAML conversion due to different annotations and formats of these two languages. This will be resolved going forward, but from our side, let’s mock test the API specifications to make sure the conversion happens well for the specification we just created.

Take your career to new heights of success with a MuleSoft Training

mulesoft

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

MuleSoft Certification Training | MuleSoft Training | ITGuru

Our Mulesoft Certification Training will provide you to learn the best testing tools easily with realty. Our Mulesoft Course also includes live sessions, live Projects.

What is Mulesoft ESB?

Online It Guru.

MuleSoft vs. Dell Boomi

With Salesforce’s acquisition of MuleSoft, the demand for MuleSoft’s Anypoint platform has grown. As a certified partner, we often use MuleSoft in our implementations. But what makes MuleSoft the standard for success compared to other integration...

MuleSoft Hits the Mark with GraphQL

We got to see more details on MuleSoft’s vision for GraphQL, and it shows MuleSoft is working aggressively to fill a gap in GraphQL. What is GraphQL, its challenges, and how MuleSoft is addressing those challenges.

How to become a Mulesoft Developer?

A Mulesoft Developer is Responsible for turning any Business Requirements into code. With Unit Testing, Deploying, monitoring and APIs.