DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Generic and Dynamic API: MuleSoft
  • Releasing MuleSoft API
  • How to Build an OpenAI Custom GPT With a Third-Party API
  • API-Led Example: MuleSoft

Trending

  • The Cypress Edge: Next-Level Testing Strategies for React Developers
  • Unlocking the Potential of Apache Iceberg: A Comprehensive Analysis
  • 5 Subtle Indicators Your Development Environment Is Under Siege
  • How to Convert XLS to XLSX in Java
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. MuleSoft With OpenAPI Specification

MuleSoft With OpenAPI Specification

In this walkthrough, you'll learn about API design and management in MuleSoft using the OpenAPI Specification, formerly Swagger.

By 
Rakesh Kumar Jha user avatar
Rakesh Kumar Jha
·
Dec. 08, 17 · Tutorial
Likes (4)
Comment
Save
Tweet
Share
15.9K Views

Join the DZone community and get the full member experience.

Join For Free

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.

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.

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.

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.

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.

Now we have a well-designed and tested RAML API specification which we can use to create Mule projects.

Let’s share our knowledge to expand our MuleSoft community.

Thank you!

MuleSoft OpenAPI Specification API

Opinions expressed by DZone contributors are their own.

Related

  • Generic and Dynamic API: MuleSoft
  • Releasing MuleSoft API
  • How to Build an OpenAI Custom GPT With a Third-Party API
  • API-Led Example: MuleSoft

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!