Installing ApiDOM

The @speclynx/apidom-reference package is one of the main entry points for working with ApiDOM. Among other capabilities, it can parse any supported API specification into a semantic data model.

npm install @speclynx/apidom-reference

Requires Node.js >=16.14.2. The package ships with TypeScript type definitions out of the box.

Try it out

Parse an API specification and access its data model right away:

import { parse } from '@speclynx/apidom-reference';
import { toValue } from '@speclynx/apidom-core';

const result = await parse('/path/to/openapi.json');

toValue(result.api.info.title);   // document title
toValue(result.api.info.version); // document version

parse() returns a data model of typed elements; toValue() from @speclynx/apidom-core turns any element back into its plain JavaScript value. See The Data Model for the full shape of what comes back, or the Parsing page for source maps, style preservation, and parsing from strings.