Camunda OpenAPI Schema Bundler

1.7.0 · active · verified Tue Apr 21

The camunda-schema-bundler is a utility designed to process and normalize the multi-file Camunda OpenAPI specification into a single, clean JSON file suitable for code generation. It addresses several common issues encountered with naive OpenAPI bundling, such as resolving path-local `$ref`s, ensuring all component schemas are included, correcting URI-encoded references (e.g., `%24like` instead of `$like`), and preventing inline duplicates of schemas by converting them to proper `#/components/schemas/...` references. Beyond the bundled spec, it also extracts structured metadata and an endpoint map, tracing operations back to their source files. The current stable version is 1.7.0, with minor releases occurring frequently, typically monthly, to introduce features like support for `x-semantic-provider` and `x-deprecated-enum-members`, and to fix bugs. It serves as a crucial pre-processing step for official Camunda SDKs in various languages, including TypeScript, C#, and Python.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates programmatically invoking the `bundle` function to fetch the latest Camunda OpenAPI specification, process it, and output the bundled spec, metadata, and endpoint map files to a specified directory.

import { bundle } from 'camunda-schema-bundler';
import * as fs from 'node:fs/promises';
import * as path from 'node:path';

async function runBundler() {
  const outputDir = path.join(process.cwd(), 'bundled-spec');
  await fs.mkdir(outputDir, { recursive: true });

  console.log('Starting Camunda schema bundling...');
  try {
    await bundle({
      fetch: true, // Fetch the latest spec from GitHub (default: main branch)
      outputSpec: path.join(outputDir, 'rest-api.bundle.json'),
      outputMetadata: path.join(outputDir, 'spec-metadata.json'),
      outputEndpointMap: path.join(outputDir, 'endpoint-map.json'),
      ref: process.env.CAMUNDA_SCHEMA_REF ?? 'main', // Use 'main' or specify a tag/branch like 'stable/8.8'
      repoUrl: process.env.CAMUNDA_SCHEMA_REPO ?? 'https://github.com/camunda/camunda-platform-7-rest-api',
    });
    console.log(`Bundling completed successfully. Output files generated in ${outputDir}`);
  } catch (error) {
    console.error('Error during bundling:', error);
    process.exit(1);
  }
}

runBundler();

view raw JSON →