contractdiff
API reference

contractdiff/openapi

Every export of contractdiff/openapi, with its signature and doc comment: OpenApiError, detect, read, openapi.

The OpenAPI input format (spec.md R1, R2): an OpenAPI 3.0, 3.1 or 3.2 document read into the model. It imports only contractdiff/core, and the core never imports it.

import { OpenApiError, detect, read, … } from 'contractdiff/openapi';

Classes

OpenApiError

A document this adapter does not read. The message ends in a fix: line.

class OpenApiError extends Error {
    constructor(reason: string, fix: string);
}

Constants

detect

Whether document declares itself as OpenAPI 3.x.

const detect: (document: unknown) => boolean;

openapi

The adapter as the plugin host will register it (spec.md R-PL1).

const openapi: Readonly<{
    name: "openapi";
    description: "OpenAPI 3.0, 3.1 and 3.2 documents, including webhooks";
    detect: (document: unknown) => boolean;
    read: (document: unknown) => Contract;
}>;

read

Read an OpenAPI 3.x document into the model.

const read: (document: unknown) => Contract;

On this page