Documenting sync and async APIs with EventCatalog
Modern applications rarely live in isolation. They combine synchronous REST APIs for immediate operations with asynchronous messaging for resilient, scalable communication. But documenting this hybrid architecture presents unique challenges—until now.
EventCatalog's OpenAPI and AsyncAPI generators solve the critical problem of unified API documentation, helping companies bridge the gap between synchronous and asynchronous communication patterns in one cohesive catalog.
The documentation divide problem
Most companies today operate in a multi-API world:
- REST APIs handle immediate operations like user authentication, data retrieval, and real-time interactions
- Event-driven architectures manage background processing, system integration, and scalable communication
Yet these two worlds often exist in documentation silos. REST APIs get documented with tools like Swagger UI, while event schemas live in separate systems or wikis. This creates several critical problems:
Governance Gaps
Without unified documentation, teams struggle to maintain consistent naming conventions, schema standards, and ownership across sync and async APIs. What starts as minor inconsistencies grows into architectural debt.
Discovery Challenges
Developers waste time hunting across multiple tools to understand how systems communicate. Finding the right API endpoint or event schema becomes an archaeological expedition through scattered documentation.
Context Loss
When sync and async APIs are documented separately, teams lose sight of how they work together. The relationship between a REST API that triggers an event and the downstream services that consume it becomes invisible.
Ownership Confusion
Who owns which API? Which team maintains that event schema? Without centralized ownership tracking, accountability becomes fuzzy, leading to technical debt and governance failures.
How EventCatalog solves the unified API documentation challenge
EventCatalog's OpenAPI and AsyncAPI generators create a single source of truth for both synchronous and asynchronous APIs. Here's how it works:
Automatic API Discovery and Documentation
Both generators automatically parse your specification files and transform them into living documentation:
// eventcatalog.config.js
generators: [
// OpenAPI Generator - Document your REST APIs
[
'@eventcatalog/generator-openapi',
{
services: [
{ path: './openapi/user-service.yml', id: 'user-service' },
{ path: './openapi/order-service.yml', id: 'order-service' },
],
domain: { id: 'core', name: 'Core Services', version: '1.0.0' },
},
],
// AsyncAPI Generator - Document your event-driven APIs
[
'@eventcatalog/generator-asyncapi',
{
services: [
{ path: './asyncapi/payment-events.yml', id: 'payment-service' },
{ path: './asyncapi/inventory-events.yml', id: 'inventory-service' },
],
domain: { id: 'commerce', name: 'Commerce', version: '1.0.0' },
},
],
],
Unified Message Classification
EventCatalog bridges the conceptual gap between REST and messaging by classifying all operations as commands, queries, or events:
- OpenAPI operations can be mapped as commands or queries using the
x-eventcatalog-message-typeextension - AsyncAPI messages can be classified using the same extension
# In your OpenAPI file
paths:
/orders:
post:
summary: Create a new order
x-eventcatalog-message-type: command
/orders/{id}:
get:
summary: Get order details
x-eventcatalog-message-type: query
# In your AsyncAPI file
components:
messages:
OrderCreated:
description: 'Event triggered when an order is created'
x-eventcatalog-message-type: event