jedison 1.22.3 → 1.23.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.
@@ -3126,7 +3126,11 @@ class InstanceObject extends Instance {
3126
3126
  const initialValue = clone(this.value);
3127
3127
  if (isSet(schemaProperties)) {
3128
3128
  Object.keys(schemaProperties).forEach((key) => {
3129
- const schema = schemaProperties[key];
3129
+ let schema = schemaProperties[key];
3130
+ if (isObject$1(schema) && this.jedison.refParser && this.jedison.refParser.hasRef(schema) && !schema["x-recursive"]) {
3131
+ schema = this.jedison.refParser.expand(schema);
3132
+ schemaProperties[key] = schema;
3133
+ }
3130
3134
  this.properties[key] = { schema };
3131
3135
  let musstCreateChild = true;
3132
3136
  const isRecursive = isSet(schema["x-recursive"]);
@@ -3364,10 +3368,15 @@ class InstanceObject extends Instance {
3364
3368
  this.createChild(schema, propertyName, value[propertyName], true);
3365
3369
  }
3366
3370
  });
3371
+ const keepMissingSchemaFields = this.jedison.getOption("keepMissingSchemaFields");
3367
3372
  for (let i = this.children.length - 1; i >= 0; i--) {
3368
3373
  const instance = this.children[i];
3369
3374
  const propertyName = instance.getKey();
3370
3375
  if (notSet(value[propertyName])) {
3376
+ const isSchemaProperty = hasOwn(this.properties, propertyName);
3377
+ if (isSchemaProperty && keepMissingSchemaFields) {
3378
+ continue;
3379
+ }
3371
3380
  if (childMap.has(propertyName)) {
3372
3381
  instance.deactivate();
3373
3382
  } else {
@@ -7515,7 +7524,7 @@ class JsonWalker {
7515
7524
  }
7516
7525
  }
7517
7526
  }
7518
- const version = "1.22.3";
7527
+ const version = "1.23.0";
7519
7528
  class Jedison extends EventEmitter {
7520
7529
  /**
7521
7530
  * Creates a Jedison instance.
@@ -7578,7 +7587,9 @@ class Jedison extends EventEmitter {
7578
7587
  subErrors: false,
7579
7588
  debug: false,
7580
7589
  audacity: true,
7581
- switcherTypeLabels: {}
7590
+ switcherTypeLabels: {},
7591
+ keepMissingSchemaFields: false
7592
+ // for backwards compatibility
7582
7593
  }, options);
7583
7594
  this.rootName = "#";
7584
7595
  this.pathSeparator = "/";