From 3f3ce6086ff80339e1d551e295381375b4ff1cdd Mon Sep 17 00:00:00 2001 From: Martin Stamm Date: Fri, 9 Feb 2024 14:35:29 +0100 Subject: [PATCH] chore: migrate to latest ajv version --- README.md | 2 +- lib/helper/validator.js | 2 +- test/spec/validationSpec.js | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index deab251..a4e9a96 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ This will print detailed information about errors inside the sample: "params": { "type": "object" }, - "message": "should be object", + "message": "must be object", "dataPointer": { "value": { "line": 0, diff --git a/lib/helper/validator.js b/lib/helper/validator.js index 7de9583..bb2b6b8 100644 --- a/lib/helper/validator.js +++ b/lib/helper/validator.js @@ -73,7 +73,7 @@ function wrapRawErrors(error) { } function setDataPointer(error, dataPointerMap) { - const dataPath = error.dataPath; + const dataPath = error.instancePath; const pointer = dataPointerMap[dataPath]; diff --git a/test/spec/validationSpec.js b/test/spec/validationSpec.js index 8dc7115..50fa01a 100644 --- a/test/spec/validationSpec.js +++ b/test/spec/validationSpec.js @@ -83,11 +83,11 @@ describe('Validator', function() { expect(object).to.equal(sample); expect(normalizedErrors).to.eql([ - { message: 'should be object', params: { type: 'object' } }, - { message: 'should be string', params: { type: 'string' } }, + { message: 'must be object', params: { type: 'object' } }, + { message: 'must be string', params: { type: 'string' } }, { message: 'invalid item for "elementType", should contain namespaced property, example: "bpmn:Task"' }, { message: 'missing elementType value' }, - { message: 'should match exactly one schema in oneOf', + { message: 'must match exactly one schema in oneOf', params: { passingSchemas: null } } ]); }); @@ -257,7 +257,7 @@ describe('Validator', function() { message: 'property.binding "zeebe:taskHeader" requires key' }, { - message: 'should be string', + message: 'must be string', params : { type: 'string' } @@ -266,7 +266,7 @@ describe('Validator', function() { message: 'feel is only supported for "String", "Text", "Number" and "Boolean" type' }, { - message: 'should be equal to one of the allowed values', + message: 'must be equal to one of the allowed values', params: { allowedValues: [ 'optional', @@ -275,7 +275,7 @@ describe('Validator', function() { } }, { - message: 'should be equal to one of the allowed values', + message: 'must be equal to one of the allowed values', params: { allowedValues: [ 'optional', @@ -294,14 +294,14 @@ describe('Validator', function() { message: 'Malformed icon source, must be a valid HTTP(s) or data URL' }, { - message: 'should be string', + message: 'must be string', params: { type: 'string' } }, - { message: 'should be array', params: { type: 'array' } }, + { message: 'must be array', params: { type: 'array' } }, { - message: 'should match exactly one schema in oneOf', + message: 'must match exactly one schema in oneOf', params: { passingSchemas: null } } ]);