@kravc/schema 2.5.0 → 2.5.1

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.0",
3
+ "version": "2.5.1",
4
4
  "description": "Advanced JSON schema manipulation and validation library.",
5
5
  "keywords": [
6
6
  "JSON",
package/src/Validator.js CHANGED
@@ -43,7 +43,7 @@ class Validator {
43
43
  this._jsonSchemasMap = keyBy(jsonSchemas, 'id')
44
44
  }
45
45
 
46
- validate(object, schemaId, shouldCleanupNullValues = false) {
46
+ validate(object, schemaId, shouldNullifyEmptyValues = false) {
47
47
  const jsonSchema = this._jsonSchemasMap[schemaId]
48
48
 
49
49
  if (!jsonSchema) {
@@ -82,7 +82,7 @@ class Validator {
82
82
 
83
83
  let validationErrors = this._engine.getLastErrors()
84
84
 
85
- if (!shouldCleanupNullValues) {
85
+ if (!shouldNullifyEmptyValues) {
86
86
  throw new ValidationError(schemaId, result, validationErrors)
87
87
  }
88
88
 
@@ -40,7 +40,7 @@ describe('Validator', () => {
40
40
  })
41
41
  })
42
42
 
43
- describe('.validate(object, schemaId, shouldCleanupNullValues = false)', () => {
43
+ describe('.validate(object, schemaId, shouldNullifyEmptyValues = false)', () => {
44
44
  it('returns validated, cleaned and normalized object', () => {
45
45
  const validator = new Validator(SCHEMAS)
46
46
 
@@ -227,7 +227,7 @@ describe('Validator', () => {
227
227
  })
228
228
  })
229
229
 
230
- describe('.validate(object, schemaId, shouldCleanupNullValues = false)', () => {
230
+ describe('.validate(object, schemaId, shouldNullifyEmptyValues = false)', () => {
231
231
  it('throws validation error for attributes not matching format or pattern', () => {
232
232
  const validator = new Validator(SCHEMAS)
233
233
 
@@ -247,7 +247,7 @@ describe('Validator', () => {
247
247
  })
248
248
  })
249
249
 
250
- describe('.validate(object, schemaId, shouldCleanupNullValues = true)', () => {
250
+ describe('.validate(object, schemaId, shouldNullifyEmptyValues = true)', () => {
251
251
  it('returns input with cleaned up null values for not required attributes', () => {
252
252
  const validator = new Validator(SCHEMAS)
253
253