# @asyncapi/openapi-schema-parser

> An AsyncAPI schema parser for OpenAPI 3.0.x and Swagger 2.x schemas.

Latest version **3.1.0** (published 2026-08-06) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @asyncapi/openapi-schema-parser
pnpm add @asyncapi/openapi-schema-parser
yarn add @asyncapi/openapi-schema-parser
bun add @asyncapi/openapi-schema-parser
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2026-08-06 |
| First published | 2020-03-11 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 36.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 144 |
| Author | The AsyncAPI maintainers |
| Maintainers | derberg |
| Keywords | asyncapi, openapi, swagger, schema, parser |

## Links

- npm: https://www.npmjs.com/package/@asyncapi/openapi-schema-parser
- Repository: https://github.com/asyncapi/parser-js
- Issues: https://github.com/asyncapi/parser-js/issues
- npm.io page: https://npm.io/package/@asyncapi/openapi-schema-parser

## Dependencies (4)

- [ajv](https://npm.io/package/ajv.md) ^8.11.0
- [ajv-errors](https://npm.io/package/ajv-errors.md) ^3.0.0
- [ajv-formats](https://npm.io/package/ajv-formats.md) ^2.1.1
- [@openapi-contrib/openapi-schema-to-json-schema](https://npm.io/package/@openapi-contrib/openapi-schema-to-json-schema.md) ~3.2.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 3.1.0 (latest) — 2026-08-06
- 3.0.24 — 2024-06-12
- 3.0.23 — 2024-06-05
- 3.0.22 — 2024-04-18
- 3.0.21 — 2024-04-15
- 3.0.20 — 2024-04-03
- 3.0.19 — 2024-03-31
- 3.0.18 — 2024-03-14
- 3.0.17 — 2024-03-14
- 3.0.16 — 2024-03-14
- 3.0.15 — 2024-02-21
- 3.0.14 — 2024-02-16
- 3.0.13 — 2024-02-04
- 3.0.12 — 2024-01-30
- 3.0.11 — 2024-01-29
- … 18 more at https://npm.io/package/@asyncapi/openapi-schema-parser/versions

## README

# OpenAPI Schema Parser

An AsyncAPI schema parser for OpenAPI 3.0.x and Swagger 2.x schemas.

> **Note**
> Version >= `3.0.0` of package is only supported by `@asyncapi/parser` version >= `2.0.0`.

> **Note**
> This package is maintained inside the [`asyncapi/parser-js`](https://github.com/asyncapi/parser-js) monorepo, under `packages/openapi-schema-parser`. It is still published to npm as `@asyncapi/openapi-schema-parser` with the same public API. Please open issues and pull requests in the `parser-js` repository.
>
> Package spec: [`docs/openapi-schema-parser/spec.md`](../../docs/openapi-schema-parser/spec.md).

<!-- toc is generated with GitHub Actions do not remove toc markers -->

<!-- toc -->

- [Installation](#installation)
- [Usage](#usage)

<!-- tocstop -->

## Installation

```bash
npm install @asyncapi/openapi-schema-parser
// OR
yarn add @asyncapi/openapi-schema-parser
```

## Usage

```ts
import { Parser } from '@asyncapi/parser';
import { OpenAPISchemaParser } from '@asyncapi/openapi-schema-parser';

const parser = new Parser();
parser.registerSchemaParser(OpenAPISchemaParser()); 

const asyncapiWithOpenAPI = `
asyncapi: 2.0.0
info:
  title: Example with OpenAPI
  version: 0.1.0
channels:
  example:
    publish:
      message:
        schemaFormat: 'application/vnd.oai.openapi;version=3.0.0'
        payload: # The following is an OpenAPI schema
          type: object
          properties:
            title:
              type: string
              nullable: true
            author:
              type: string
              example: Jack Johnson
`;

const { document } = await parser.parse(asyncapiWithOpenAPI);
```

```js
const { Parser } = require('@asyncapi/parser');
const { OpenAPISchemaParser } = require('@asyncapi/openapi-schema-parser');

const parser = new Parser();
parser.registerSchemaParser(OpenAPISchemaParser()); 

const asyncapiWithOpenAPI = `
asyncapi: 2.0.0
info:
  title: Example with OpenAPI
  version: 0.1.0
channels:
  example:
    publish:
      message:
        schemaFormat: 'application/vnd.oai.openapi;version=3.0.0'
        payload: # The following is an OpenAPI schema
          type: object
          properties:
            title:
              type: string
              nullable: true
            author:
              type: string
              example: Jack Johnson
`;

const { document } = await parser.parse(asyncapiWithOpenAPI);
```

It also supports referencing remote OpenAPI schemas:

```ts
import { Parser } from '@asyncapi/parser';
import { OpenAPISchemaParser } from '@asyncapi/openapi-schema-parser';

const parser = new Parser();
parser.registerSchemaParser(OpenAPISchemaParser()); 

const asyncapiWithOpenAPI = `
asyncapi: 2.0.0
info:
  title: Example with OpenAPI
  version: 0.1.0
channels:
  example:
    publish:
      message:
        schemaFormat: 'application/vnd.oai.openapi;version=3.0.0'
        payload:
          $ref: 'yourserver.com/schemas#/Book'
`;

const { document } = await parser.parse(asyncapiWithOpenAPI);
```

---
_Source: https://npm.io/package/@asyncapi/openapi-schema-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
