← All tools

@oasdiff-js/oasdiff-js

Popularity 65 Updated Development & Build

TypeScript/JavaScript wrapper for the oasdiff CLI

npmauto-collected

Installation

npm
npm install -g @oasdiff-js/oasdiff-js

Install with npm.

<h1 align="center"oasdiff-js</h1

<p align="center" TypeScript/JavaScript wrapper for <a href="https://github.com/oasdiff/oasdiff"oasdiff</a - a Go CLI for comparing OpenAPI specifications. </p

Installation

npm install @oasdiff-js/oasdiff-js
yarn add @oasdiff-js/oasdiff-js
pnpm add @oasdiff-js/oasdiff-js
bun add @oasdiff-js/oasdiff-js

The correct oasdiff binary for your platform is installed automatically via an optional dependency (macOS, Linux, Windows).

Development

The upstream oasdiff version used by this repo is oasdiffVersion in package.json.

After changing it locally, sync the dev binary for your platform before running tests or examples:

bun run sync-binaries

Source code uses .oasdiff-bin/. Published packages use platform-specific optional dependencies instead.

Versioning model

Native packages (@oasdiff-js/oasdiff-) are versioned to match the upstream oasdiff binary they contain. The main @oasdiff-js/oasdiff-js package follows its own semver and pins exact native versions in optionalDependencies.

Usage

Programmatic API

import {runOasdiffBreaking} from "@oasdiff-js/oasdiff-js";

const result = await runOasdiffBreaking("base.yaml", "revision.yaml");

console.log(result.changes);
// [{ id: "api-removed-without-deprecation", text: "...", level: 3, ... }]