Skip to content

Commit 079d4e3

Browse files

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

json-multi-schema-validator.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
*/
77

88
//Ajv: Another JSON Schema Validator
9-
const Ajv = require('ajv');
9+
const Ajv = require('ajv').default;
10+
const addFormats = require('ajv-formats').default;
1011
const util = require('util');
1112

1213
module.exports = RED => {
@@ -21,11 +22,12 @@ module.exports = RED => {
2122

2223
const jsonCache = require('./json-cache.js')(node);
2324

24-
const ajv = Ajv({
25+
const ajv = new Ajv({
2526
allErrors: true, //TODO: Make a parameter
2627
loadSchema: jsonCache.loadAsync,
2728
messages: true, //TODO: Make a parameter
2829
});
30+
addFormats(ajv);
2931

3032
//Cache of validators for different schemas
3133
const validators = {};

package-lock.json

Lines changed: 22 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-contrib-json-multi-schema",
3-
"version": "1.2.6",
3+
"version": "1.3.0",
44
"description": "Generic JSON data pipeline tools, with dynamic transformation (using JSONata rules), resolving JSON Schema (using JSONata rules), and then validation (using JSON Schema). For Node-RED and for command-line.",
55
"main": "index.js",
66
"readmeFilename": "readme.md",
@@ -33,7 +33,8 @@
3333
"url": "https://github.com/alexandrainst/node-red-contrib-json-multi-schema.git"
3434
},
3535
"dependencies": {
36-
"ajv": "^6.12.6",
36+
"ajv": "^8.6.0",
37+
"ajv-formats": "^2.1.0",
3738
"jsonata": "^1.8.4",
3839
"node-fetch": "^2.6.1",
3940
"node-red-contrib-mock-cli": "^1.0.10"

0 commit comments

Comments
 (0)