@hestia-earth/schema-validation 31.3.0 → 31.4.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": "@hestia-earth/schema-validation",
3
- "version": "31.3.0",
3
+ "version": "31.4.0",
4
4
  "description": "HESTIA Schema Validation",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
package/validate.js CHANGED
@@ -73,12 +73,14 @@ var validateSchemaType = function (schemas, content) {
73
73
  return true;
74
74
  };
75
75
  var schemaData = function (_a) {
76
- var required = _a.required;
77
- return (__assign({}, ((required === null || required === void 0 ? void 0 : required.length) ? { required: required } : {})));
76
+ var required = _a.required, properties = _a.properties;
77
+ return (__assign(__assign({}, ((required === null || required === void 0 ? void 0 : required.length) ? { required: required } : {})), (properties ? { properties: properties } : {})));
78
78
  };
79
79
  // using `verbose: true` includes data which we don't need
80
80
  var cleanErrors = function (errors) {
81
- return errors.map(function (_a) {
81
+ return errors
82
+ .filter(function (error) { return !['if'].includes(error.keyword); })
83
+ .map(function (_a) {
82
84
  var data = _a.data, schema = _a.schema, parentSchema = _a.parentSchema, error = __rest(_a, ["data", "schema", "parentSchema"]);
83
85
  return (__assign(__assign(__assign({}, error), (schema ? { schema: schemaData(schema) } : {})), (error.message === 'should NOT be valid' ? { schema: schema } : {})));
84
86
  });
@@ -41,8 +41,8 @@ var validate = function (_schema, value, _parentSchema, dataPath) {
41
41
  };
42
42
  })
43
43
  .filter(Boolean);
44
- // only return the first 100 errors to limit the memory footprint
45
- exports.validate.errors = errors.slice(0, 100);
44
+ // only return the first 10 errors to limit the memory footprint
45
+ exports.validate.errors = errors.slice(0, 10);
46
46
  return errors.length === 0;
47
47
  };
48
48
  exports.validate = validate;
@@ -18,8 +18,8 @@ var validate = function (_schema, value, _parentSchema, dataPath) {
18
18
  };
19
19
  })
20
20
  .filter(Boolean);
21
- // only return the first 100 errors to limit the memory footprint
22
- exports.validate.errors = errors.slice(0, 100);
21
+ // only return the first 10 errors to limit the memory footprint
22
+ exports.validate.errors = errors.slice(0, 10);
23
23
  return errors.length === 0;
24
24
  };
25
25
  exports.validate = validate;