# swagger2har

> Generate HAR objects from Swagger specs

Latest version **1.0.6** (published 2023-12-21) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install swagger2har
pnpm add swagger2har
yarn add swagger2har
bun add swagger2har
```

## 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 | 1.0.6 |
| Published | 2023-12-21 |
| First published | 2018-04-02 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 17.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Darren Jennings |
| Maintainers | darrenjennings, konginc |
| Keywords | swagger, har, json |

## Links

- npm: https://www.npmjs.com/package/swagger2har
- npm.io page: https://npm.io/package/swagger2har

## Dependencies (2)

- [rollup-plugin-babel](https://npm.io/package/rollup-plugin-babel.md) ^4.4.0
- [json-schema-instantiator](https://npm.io/package/json-schema-instantiator.md) 0.4.4

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.6 (latest) — 2023-12-21
- 1.0.5 — 2023-03-06
- 1.0.4 — 2023-01-30
- 1.0.3 — 2023-01-13
- 1.0.2 — 2023-01-13
- 1.0.1 — 2021-05-24
- 1.0.0 — 2021-05-21
- 0.1.2 — 2018-12-10
- 0.1.1 — 2018-11-01
- 0.1.0 — 2018-04-02

## README

# swagger2har

Transform you Swagger OAI spec files to a series of HAR request objects.

* http://swagger.io/specification/
* http://www.softwareishard.com/blog/har-12-spec/#request

## Setup

```bash
npm install
```

## Usage



Using as a ES module:
```js
import { swagger2har }  from 'swagger2har';
import swaggerJSON from 'your-swagger-api.json'; // e.g. http://petstore.swagger.io/v2/swagger.json

swagger2har(swaggerJSON);
```

To create HAR Request object for one path and method pair described in a given swagger use createHar directly

```js
import { createHar }  from 'swagger2har';
import swaggerJSON from 'your-swagger-api.json'; // e.g. http://petstore.swagger.io/v2/swagger.json

createHar(swaggerJSON, '/pet/findByTags', 'get', 'http://petstore.swagger.io');
```

## Testing

```bash
yarn test
```

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