Skip to main content

Installation

View as Markdown

The OpenAPI plugin is used to generate a catalog from an OpenAPI specification files.

You can map your OpenAPI files to commands, events and queries in your catalog, and assign these to services and domains.

Installation​

Run the command below to install the EventCatalog OpenAPI plugin.

npm i @eventcatalog/generator-openapi

Configuration​

Configure the plugin in your eventcatalog.config.js file.

Add the plugin to the generators array.

eventcatalog.config.js
// ...
generators: [
[
'@eventcatalog/generator-openapi',
{
services: [
{ path: path.join(__dirname, 'openapi-files', 'orders-service.yml'), id: 'orders-service' },
],
domain: { id: 'orders', name: 'Orders', version: '0.0.1' },
},
],
// Add many openapi files to a domain
[
'@eventcatalog/generator-openapi',
{
services: [
{ path: path.join(__dirname, 'openapi-files', 'payment-service.yml'), id: 'payment-store' },
{ path: path.join(__dirname, 'openapi-files', 'fraud-detection-service.yml'), id: 'fraud-detection-service' },
],
domain: { id: 'payment', name: 'Payment', version: '0.0.1' },
},
],
],
};

This plugin is open source under the MIT License and doesn't need a license key. If your config still sets licenseKey or an EVENTCATALOG_LICENSE_KEY_* variable, you can remove it; it's ignored.

Run the plugin​

This command will run the generators in your eventcatalog.config.js file.

npm run generate

View your catalog​

Run your catalog locally to see the changes

npm run dev

Any questions or need help?​

If you get stuck, find an issue or need help, please raise an issue on GitHub or join our Discord community.