jedison 0.3.14 → 0.3.16
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/CHANGELOG.md +8 -0
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +39 -8
- package/dist/esm/jedison.js.map +1 -1
- package/dist/umd/jedison.umd.js +1 -1
- package/dist/umd/jedison.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/jedison.js
CHANGED
|
@@ -893,16 +893,15 @@ function properties(context) {
|
|
|
893
893
|
Object.keys(schemaProperties).forEach((propertyName) => {
|
|
894
894
|
if (hasOwn(context.value, propertyName)) {
|
|
895
895
|
const propertySchema = schemaProperties[propertyName];
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
if (
|
|
896
|
+
const propertyErrors = context.validator.getErrors(
|
|
897
|
+
context.value[propertyName],
|
|
898
|
+
propertySchema,
|
|
899
|
+
propertyName,
|
|
900
|
+
context.path + "/" + propertyName
|
|
901
|
+
);
|
|
902
|
+
if (propertyErrors.length > 0) {
|
|
903
903
|
invalidProperties.push(propertyName);
|
|
904
904
|
}
|
|
905
|
-
editor.destroy();
|
|
906
905
|
}
|
|
907
906
|
});
|
|
908
907
|
}
|
|
@@ -2295,6 +2294,9 @@ class InstanceIfThenElse extends Instance {
|
|
|
2295
2294
|
this.emit("change", initiator2);
|
|
2296
2295
|
});
|
|
2297
2296
|
});
|
|
2297
|
+
if (initiator === "api" && this.hasNullableFields(this.activeInstance)) {
|
|
2298
|
+
this.activeInstance.setValue(value, false, "secondary");
|
|
2299
|
+
}
|
|
2298
2300
|
this.value = this.activeInstance.getValue();
|
|
2299
2301
|
}
|
|
2300
2302
|
getWithoutIfValueFromValue(value) {
|
|
@@ -2324,6 +2326,35 @@ class InstanceIfThenElse extends Instance {
|
|
|
2324
2326
|
});
|
|
2325
2327
|
}
|
|
2326
2328
|
}
|
|
2329
|
+
/**
|
|
2330
|
+
* Check if an instance has nullable fields in its schema or children
|
|
2331
|
+
*/
|
|
2332
|
+
hasNullableFields(instance) {
|
|
2333
|
+
if (!instance) return false;
|
|
2334
|
+
if (this.isNullableSchema(instance.schema)) {
|
|
2335
|
+
return true;
|
|
2336
|
+
}
|
|
2337
|
+
if (instance.children) {
|
|
2338
|
+
return instance.children.some((child) => this.hasNullableFields(child));
|
|
2339
|
+
}
|
|
2340
|
+
return false;
|
|
2341
|
+
}
|
|
2342
|
+
/**
|
|
2343
|
+
* Check if a schema is nullable (has x-format: 'number-nullable' or similar nullable formats)
|
|
2344
|
+
*/
|
|
2345
|
+
isNullableSchema(schema) {
|
|
2346
|
+
if (!schema) return false;
|
|
2347
|
+
if (schema["x-format"] && schema["x-format"].includes("nullable")) {
|
|
2348
|
+
return true;
|
|
2349
|
+
}
|
|
2350
|
+
if (Array.isArray(schema.type) && schema.type.includes("null")) {
|
|
2351
|
+
return true;
|
|
2352
|
+
}
|
|
2353
|
+
if (schema.properties) {
|
|
2354
|
+
return Object.values(schema.properties).some((prop) => this.isNullableSchema(prop));
|
|
2355
|
+
}
|
|
2356
|
+
return false;
|
|
2357
|
+
}
|
|
2327
2358
|
/**
|
|
2328
2359
|
* Returns the index of the instance that has less validation errors
|
|
2329
2360
|
*/
|