Using Event-Driven AsyncAPI Specifications with SwaggerHub

  May 11, 2023

Microservices continue to be the leading growth driver of APIs in organizations, according to the latest State of Software Quality – API – 2023 from SmartBear.  

The API world has grown tremendously since REST and SOAP. While request-response APIs aren’t going anywhere, event-driven architectures (EDAs) are emerging as an improved core component to organizations. They act as the central bus that RESTful and other API systems can integrate with. EDAs offer a more flexible and scalable solution for development teams looking to better manage their scaling microservice estates.   

While EDAs have steadily established themselves, there needs to be more governance and control over those systems. Today, the AsyncAPI open-source initiative seeks to bring to EDAs what OpenAPI and Swagger brought to RESTful systems.   

EDAs provide an enhanced developer experience through decoupled services and centralized infrastructure across both B2B and B2C verticals, like e-Commerce, Financial Services, and Insurance. 

SwaggerHub Welcomes Support for AsyncAPI  

While event driven APIs are not as widely adopted as RESTful APIs, they are growing in popularity. AsyncAPI is the leading specification to document and describe event-driven API architectures. As with OpenAPI, organizations will choose to adopt AsyncAPI to have control and govern over their event-driven API.  

At SmartBear, we’ve seen and stewarded Swagger and OpenAPI from early stages through to wide-spread adoption. We are excited to see how many of these patterns can be applied to AsyncAPI as we increase support in SwaggerHub and across the tooling portfolio.  

Benefits of Using AsyncAPI in SwaggerHub 

As an organization’s microservices architecture grows, it becomes more common to have a mix of both RESTful and event-driven APIs in concert.  

The benefit of using SwaggerHub is centralizing the cataloging of these different APIs, supporting collaborative workflows, and reducing costs through standardization and governance. Keeping both RESTful and event-driven APIs close together is an important step in managing a portfolio. With this single API catalog, developers, architects, designers, and consumers alike can benefit from improved discovery, and heightened governance. 

SwaggerHub gives teams across an entire organization the same experience for both AsyncAPI and OpenAPI for API design, documentation, collaboration, and standardization.  

Why Standardization is Important 

According to the 2023 State of Software Quality – API – 51% of respondents see standardization as the top challenge they need to solve. 

Let’s consider a scenario: as an organization, you may decide that your API definitions need to have contact details. It is a small detail that senior designers need to constantly remind new designers to add and ensure they exist. Small things have big impacts. In this scenario, it is easy to imagine the amount of time that can go to waste searching for the right contact.  

Along with this scenario, other pitfalls teams may experience when not using API standardization include: 

  • Security risks - There is a risk of exposing sensitive data when APIs are not designed with security in mind. 

  • Integration issues - There can be wasted time understanding different APIs and how they work. Any misunderstandings in this process lead to errors. 

  • Increased costs - More lead time and resources are required to develop and maintain APIs and it is difficult to find developers familiar with API. 

  • Inconsistent data formats - Poor developer experience and potential integration issues when API data formats are inconsistent. 

  • Reduced scalability - With more APIs being added, it is more difficult to scale when they are not standardized. 

AsyncAPI Standardization in SwaggerHub 

Back to the scenario above, the best way to ensure those details are never forgotten is adding standardization to the design process using SwaggerHub – now supporting both RESTful and Async specifications. Using standardization practices across both protocols, teams can accelerate their design while upholding quality and style consistency. You can use custom and built-in rules to enforce API governance from organization-specific style guides. Development teams can feel confident they create APIs that will pass internal gate-checks and work as designed. 

It is worth calling out one element of standardizing your API portfolio - linting. The red squiggly lines we've all come to know in Microsoft Word when a spelling error occurs. In the world of APIs, linting shows in IDEs which can act as signposts to guiding our actions and clarifying our intent. 

See how to use AsyncAPI standardization in SwaggerHub as well as the list of rules currently supported, in the  SwaggerHub documentation

Influence of Spectral on Standardization Rules  

When looking to see how the industry moves towards standardization around AsyncAPI, the leading tool at the time, was Spectral. The list of rules chosen in SwaggerHub is greatly influenced by the Spectral ruleset for AsyncAPI. These rules are based on the amazing work done in the open-source community there.  

AsyncAPI Support for SmartBear Tools  

SmartBear is committed to finding new ways to integrate the different parts of the API Lifecycle and narrow the gap on developer visibility. When it comes to testing AsyncAPI, we’ve got all the bases covered. 

PactFlow, the leading contract testing tool, makes it simple to catch breaking changes relating to your AsyncAPIs before they cause issues later in the SDLC – you can use contract testing for your Async services. Currently, PactFlow does not support AsyncAPI but work to create this capability is on the roadmap

Get full coverage with our premier end-to-end testing tool, ReadyAPI, which now supports AsyncAPI definitions. Build out your Kafka stack by importing (integrating) AsyncAPI designs generated and managed in SwaggerHub straight into ReadyAPI to test. Read more here

CTA Box: Ready to start using SwaggerHub’s AsyncAPI support? Log into your account or create a free trial