# jasmine-ajv

> Jasmine JSON Schema matcher with AJV help

Latest version **1.0.1** (published 2017-01-13) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install jasmine-ajv
pnpm add jasmine-ajv
yarn add jasmine-ajv
bun add jasmine-ajv
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-01-13 |
| First published | 2017-01-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Maxim Malov |
| Maintainers | maxmalov |
| Keywords | jasmine, ajv, jsonschema, validator |

## Links

- npm: https://www.npmjs.com/package/jasmine-ajv
- Repository: https://github.com/maxmalov/jasmine-ajv
- Homepage: https://github.com/maxmalov/jasmine-ajv#readme
- Issues: https://github.com/maxmalov/jasmine-ajv/issues
- npm.io page: https://npm.io/package/jasmine-ajv

## Dependencies (1)

- [ajv](https://npm.io/package/ajv.md) ^4.10.4

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-01-13
- 1.0.0 — 2017-01-12

## README

# jasmine-ajv

[![Build Status](https://travis-ci.org/maxmalov/jasmine-ajv.svg?branch=master)](https://travis-ci.org/maxmalov/jasmine-ajv)

This plugin was inspired by [chai-json-schema](http://chaijs.com/plugins/chai-json-schema/) and [chai-json-schema-ajv](http://chaijs.com/plugins/chai-json-schema-ajv/).

### Installation

```
npm install --save-dev jasmine-ajv
```

### JSON Schema and Ajv

For any references, please follow

- [JSON schema specification](http://json-schema.org/)
- [Ajv documentation](https://github.com/epoberezkin/ajv)

### Setup and usage

For Jasmine, you'll need to call install function in any place due to the way jasmine's plugin system works, ex in `beforeEach`:

```js
const installJsonSchemaMatcher = require('jasmine-ajv');

beforeEach(() => installJsonSchemaMatcher(jasmine));

it('should has toBeJsonSchema matcher', () => {
  expect(pojo).toBeJsonSchema(mySchema);
});
```

#### And you can use it even with jest

You need specify [setup test file](https://facebook.github.io/jest/docs/configuration.html#setuptestframeworkscriptfile-string), if you haven't done so. After that add the following code to your setup file:

```js

// setup file

const installJsonSchemaMatcher = require('jasmine-ajv');

installJsonSchemaMatcher(jasmine);

// and later in tests

test('how awesome it is', () => {
  expect(pojo).toBeJsonSchema(mySchema);
});
```

and you're ready to go!

### Browser support

> TBD, if you have a PR, you're welcome!

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