# @apielements/openapi2-parser

> Swagger 2.0 parser for Fury.js

Latest version **0.32.6** (published 2021-07-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @apielements/openapi2-parser
pnpm add @apielements/openapi2-parser
yarn add @apielements/openapi2-parser
bun add @apielements/openapi2-parser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.32.6 |
| Published | 2021-07-15 |
| First published | 2020-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 8 |
| Unpacked size | 123.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 79 |
| Author | Apiary.io |
| Maintainers | kylef, patrickmedina, apiary-sre |

## Links

- npm: https://www.npmjs.com/package/@apielements/openapi2-parser
- Repository: https://github.com/apiaryio/api-elements.js
- Homepage: https://github.com/apiaryio/api-elements.js/tree/master/packages/openapi2-parser
- Issues: https://github.com/apiaryio/api-elements.js/issues
- npm.io page: https://npm.io/package/@apielements/openapi2-parser

## Dependencies (8)

- [lodash](https://npm.io/package/lodash.md) ^4.17.0
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.12.0
- [yaml-js](https://npm.io/package/yaml-js.md) ^0.2.3
- [z-schema](https://npm.io/package/z-schema.md) ^4.1.0
- [media-typer](https://npm.io/package/media-typer.md) ^1.0.1
- [content-type](https://npm.io/package/content-type.md) ^1.0.4
- [swagger-parser](https://npm.io/package/swagger-parser.md) ^8.0.0
- [json-schema-faker](https://npm.io/package/json-schema-faker.md) 0.5.0-rc23

## Recent versions

- 0.32.6 (latest) — 2021-07-15
- 0.32.5 — 2021-02-24
- 0.32.4 — 2020-10-13
- 0.32.3 — 2020-08-06
- 0.32.2 — 2020-07-22
- 0.32.1 — 2020-06-22
- 0.32.0 — 2020-06-12
- 0.31.1 — 2020-06-09
- 0.31.0 — 2020-05-13
- 0.30.0 — 2020-04-29

## README

# API Elements: OpenAPI 2.0 Adapter

[![NPM version](https://img.shields.io/npm/v/@apielements/openapi2.svg)](https://www.npmjs.org/package/@apielements/openapi2)
[![License](https://img.shields.io/npm/l/@apielements/openapi2.svg)](https://www.npmjs.org/package/@apielements/openapi2)

This adapter provides support for parsing [Swagger 2.0](http://swagger.io/) in [Fury](https://github.com/apiaryio/api-elements.js/tree/master/packages/fury). It does not yet provide a serializer.

## Install

```sh
$ npm install @apielements/openapi2
```

## Usage

```js
import fury from 'fury';
import openApi2Parser from '@apielements/openapi2';

fury.use(openApi2Parser);

fury.parse({source: '... your OpenAPI 2.0 document ...'}, (err, result) => {
  if (err) {
    console.log(err);
    return;
  }

  // The returned `result` is a Minim parse result element.
  console.log(result.api.title);
});
```

### Parser Codes

The following codes are used by the parser when creating warning and error annotations.

Warnings:

Code | Description
---: | -----------
   2 | Source maps are unavailable due either to the input format or an issue parsing the input.
   3 | Data is being lost in the conversion.

Errors:

Code | Description
---: | -----------
   1 | Error parsing input (e.g. malformed YAML).
   4 | Swagger validation error.
   5 | Swagger to Refract converter error (JS exception).

### Swagger Vendor Extensions

Some Swagger Vendor extensions found in source Swagger documents are converted
into the output API Element as extension elements.

The following locations of vendor extensions are supported:

- within the info object
- within the paths object
- within the path-item object
- within the operation object
- within the responses object
- within the security-scheme object

These vendor extensions will be available as extensions using the relation
[`https://help.apiary.io/profiles/api-elements/vendor-extensions/`](https://help.apiary.io/profiles/api-elements/vendor-extensions/).

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