@kravc/schema 2.5.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kravc/schema",
3
- "version": "2.5.1",
3
+ "version": "2.6.0",
4
4
  "description": "Advanced JSON schema manipulation and validation library.",
5
5
  "keywords": [
6
6
  "JSON",
package/src/Validator.js CHANGED
@@ -27,7 +27,7 @@ class Validator {
27
27
  }
28
28
 
29
29
  this._engine = new ZSchema({
30
- reportPathAsArray: true,
30
+ reportPathAsArray: false,
31
31
  ignoreUnknownFormats: true,
32
32
  })
33
33
 
@@ -291,6 +291,7 @@ describe('Validator', () => {
291
291
  const error = validationError.toJSON()
292
292
 
293
293
  expect(error.message).to.eql('"Profile" validation failed')
294
+
294
295
  expect(error.validationErrors).to.have.lengthOf(4)
295
296
 
296
297
  expect(error.validationErrors[0].code).to.eql('INVALID_TYPE')
@@ -21,7 +21,7 @@ const nullifyEmptyValues = (object, validationErrors) => {
21
21
  const otherValidationErrors = []
22
22
 
23
23
  for (const error of validationErrors) {
24
- const { code, path } = error
24
+ const { code } = error
25
25
 
26
26
  const isAttributeRequired = error[schemaSymbol]['x-required'] === true
27
27
  const isFormatError = FORMAT_ERROR_CODES.includes(code)
@@ -36,6 +36,9 @@ const nullifyEmptyValues = (object, validationErrors) => {
36
36
  continue
37
37
  }
38
38
 
39
+ const { path: pathString } = error
40
+ const path = pathString.replace('#/', '').split('/')
41
+
39
42
  const json = error[jsonSymbol]
40
43
  const value = get(json, path)
41
44