@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
package/src/Validator.js
CHANGED
package/src/Validator.spec.js
CHANGED
|
@@ -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
|
|
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
|
|