# swagger2-utils

> Utilities for validating and working with swagger 2.0 documents

Latest version **2.0.10** (published 2015-01-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install swagger2-utils
pnpm add swagger2-utils
yarn add swagger2-utils
bun add swagger2-utils
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.10 |
| Published | 2015-01-30 |
| First published | 2015-01-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jeff Flitton |
| Maintainers | jflitton |
| Keywords | swagger 2.0, swagger, 2.0, swagger validator, swagger parser |

## Links

- npm: https://www.npmjs.com/package/swagger2-utils
- Repository: https://github.com/jflitton/swagger2-utils
- Issues: https://github.com/jflitton/swagger2-utils/issues
- npm.io page: https://npm.io/package/swagger2-utils

## Dependencies (3)

- [clone](https://npm.io/package/clone.md) ^0.2.0
- [traverse](https://npm.io/package/traverse.md) ^0.6.6
- [z-schema](https://npm.io/package/z-schema.md) ^3.3.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.0.10 (latest) — 2015-01-30
- 2.0.9 — 2015-01-29
- 2.0.8 — 2015-01-29
- 2.0.7 — 2015-01-29
- 2.0.6 — 2015-01-29
- 2.0.5 — 2015-01-29
- 1.0.3 — 2015-01-27
- 1.0.2 — 2015-01-27

## README

# swagger2-utils
Utilities for validating and working with swagger 2.0 documents in Node.js

## Installation
```shell
npm install swagger2-utils
```

## Validate
Validates the supplied swagger document object against the official swagger 2.0 schema.
Returns a boolean indicating validity.

```javascript
var swagger2 = require('swagger2-utils');
var swaggerDoc = require('my-swagger-doc.json');

var valid = swagger2.validate(swaggerDoc);

if valid {
  console.log('valid!');
}
else {
  console.log('failed!');
  throw swagger2.validationError
}
```

## Dereference
Returns a new object where all $ref keys are replaced with the value they reference.

```javascript
var dereferencedDoc = swagger2.dereference(swaggerDoc);
```

## Create Operations List
Creates an array of operation objects.  These objects contain the "concrete" operations, meaning they have
incorporated the schemes, parameters, custom fields, etc from the root and path-level objects.

```javascript
var operationsList = swagger2.createOperationsList(swaggerDoc);
```

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