# swagger-zoo

> Swagger example files for testing

Latest version **3.1.4** (published 2020-10-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install swagger-zoo
pnpm add swagger-zoo
yarn add swagger-zoo
bun add swagger-zoo
```

## 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 | 3.1.4 |
| Published | 2020-10-13 |
| First published | 2016-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 1 |
| Unpacked size | 4.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 79 |
| Author | Apiary.io |
| Maintainers | kylef, klokane, apiary-sre |

## Links

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

## Dependencies (1)

- [glob](https://npm.io/package/glob.md) ^7.1.2

## Recent versions

- 3.1.4 (latest) — 2020-10-13
- 3.1.3 — 2020-05-13
- 3.1.2 — 2020-01-30
- 3.1.1 — 2019-08-08
- 3.1.0 — 2019-06-11
- 3.0.0 — 2019-03-26
- 2.20.1 — 2019-03-05
- 2.20.0 — 2019-01-04
- 2.19.2 — 2018-10-23
- 2.19.1 — 2018-10-11
- 2.19.0 — 2018-10-08
- 2.18.0 — 2018-09-07
- 2.17.2 — 2018-09-07
- 2.17.1 — 2018-09-05
- 2.17.0 — 2018-09-04
- … 41 more at https://npm.io/package/swagger-zoo/versions

## README

# Swagger Zoo

This repository contains a collection of [Swagger](http://swagger.io/) sample files and their parsed [Refract](https://github.com/refractproject/refract-spec) results. These files are suitable for testing.

## Usage

You can use it either as an `npm` module or a `git` submodule.

**npm**

First, install the module:

```sh
npm install swagger-zoo
```

Then use it:

```js
import zoo from 'swagger-zoo';

// Features are tiny examples of various Swagger features
for (const feature of zoo.features()) {
  console.log(`Feature: ${feature.name}`);

  // String of the swagger source
  console.log(feature.swagger);

  // The api-elements is loaded as an object, so we stringify it
  // here to print it out.
  console.log(JSON.stringify(feature.apiElements, null, 2));

  // The api-elements with source maps is also loaded similarly
  console.log(JSON.stringify(feature.apiElementsSourceMap, null, 2));
}

// Examples are real-world API examples
for (const example of zoo.examples()) {
  console.log(`Example: ${example.name}`);
  console.log(example.swagger);
  console.log(JSON.stringify(example.apiElements, null, 2));
  console.log(JSON.stringify(example.apiElementsSourceMap, null, 2));
}

// Or, you can easily get all of the above together in one go
for (const sample of zoo.samples()) {
  console.log(`Sample: ${sample.name}`);
  console.log(sample.swagger);
  console.log(JSON.stringify(sample.apiElements, null, 2));
  console.log(JSON.stringify(sample.apiElementsSourceMap, null, 2));
}
```

**git**

If you are not using Javascript or a related language, then you can still get the test files using `git`:

```sh
$ git submodule add https://github.com/apiaryio/api-elements.js
```

The files are in `api-elements.js/packages/swagger-zoo/fixtures/features` and `api-elements.js/packages/swagger-zoo/fixtures/examples`, which correspond to the Javascript functions explained above.

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