Skip to content

Commit

Permalink
feat: adding support for ajv@8 (#2)
Browse files Browse the repository at this point in the history
* chore(deps): upgrading deps

* feat: adding support for ajv@8

Work based off work from ext on atlassian#92.

Co-authored-by: ext <ext-github@sidvind.com>

Co-authored-by: ext <ext-github@sidvind.com>
  • Loading branch information
erunion and ext authored Oct 11, 2021
1 parent 26e46e3 commit 31af28c
Show file tree
Hide file tree
Showing 15 changed files with 749 additions and 6,204 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import betterAjvErrors from 'better-ajv-errors';
// const Ajv = require('ajv');
// const betterAjvErrors = require('better-ajv-errors');

// You need to pass `jsonPointers: true`
// If you're on anything less than `ajv@7` you need to pass `jsonPointers: true`
const ajv = new Ajv({ jsonPointers: true });

// Load schema and data
Expand Down Expand Up @@ -90,8 +90,7 @@ Or, use `js` if you are planning to use this with some API. Your output will loo
{
start: { line: 6, column: 15, offset: 70 },
end: { line: 6, column: 26, offset: 81 },
error:
'/content/0/type should be equal to one of the allowed values: panel, paragraph, ...',
error: '/content/0/type should be equal to one of the allowed values: panel, paragraph, ...',
suggestion: 'Did you mean paragraph?',
},
];
Expand All @@ -116,4 +115,5 @@ Gives accurate line and column listings.

## Differences from `better-ajv-errors`

- Only supports current Node LTS releases.
- Only targets current Node LTS releases
- AJV 8 support
4 changes: 2 additions & 2 deletions example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const data = require('./src/__fixtures__/default/data.json');
const betterAjvErrors = require('./lib');

// options can be passed, e.g. {allErrors: true}
// const ajv = new Ajv({ allErrors: true, async: 'es7', jsonPointers: true });
const ajv = new Ajv({ jsonPointers: true });
// const ajv = new Ajv({ allErrors: true, async: 'es7');
const ajv = new Ajv();

const validate = ajv.compile(schema);
const valid = validate(data);
Expand Down
Loading

0 comments on commit 31af28c

Please sign in to comment.