@hestia-earth/schema-validation 27.0.0 → 27.2.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": "27.0.0",
3
+ "version": "27.2.0",
4
4
  "description": "Hestia Schema Validation",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
package/validate.d.ts CHANGED
@@ -11,15 +11,13 @@ import { definitions } from '@hestia-earth/json-schema';
11
11
  export declare const validateContent: (ajv: Ajv.Ajv, schemas: definitions) => (content: HestiaJson<SchemaType>) => Promise<{
12
12
  success: any;
13
13
  errors: {
14
- schema?: {
15
- required?: any;
16
- };
14
+ schema?: any;
15
+ keyword: string;
17
16
  dataPath: string;
18
17
  schemaPath: string;
19
18
  params: Ajv.ErrorParameters;
20
19
  propertyName?: string;
21
20
  message?: string;
22
- keyword: string;
23
21
  }[];
24
22
  }>;
25
23
  export declare const initAjv: () => Ajv.Ajv;
@@ -33,14 +31,12 @@ export declare const initAjv: () => Ajv.Ajv;
33
31
  export declare const validator: (domain?: string, strictMode?: boolean) => (content: HestiaJson<SchemaType>) => Promise<{
34
32
  success: any;
35
33
  errors: {
36
- schema?: {
37
- required?: any;
38
- };
34
+ schema?: any;
35
+ keyword: string;
39
36
  dataPath: string;
40
37
  schemaPath: string;
41
38
  params: Ajv.ErrorParameters;
42
39
  propertyName?: string;
43
40
  message?: string;
44
- keyword: string;
45
41
  }[];
46
42
  }>;
package/validate.js CHANGED
@@ -78,8 +78,8 @@ var schemaData = function (_a) {
78
78
  // using `verbose: true` includes data which we don't need
79
79
  var cleanErrors = function (errors) {
80
80
  return errors.map(function (_a) {
81
- var keyword = _a.keyword, data = _a.data, schema = _a.schema, parentSchema = _a.parentSchema, error = __rest(_a, ["keyword", "data", "schema", "parentSchema"]);
82
- return (__assign(__assign({ keyword: keyword }, error), (schema ? { schema: schemaData(schema) } : {})));
81
+ var data = _a.data, schema = _a.schema, parentSchema = _a.parentSchema, error = __rest(_a, ["data", "schema", "parentSchema"]);
82
+ return (__assign(__assign(__assign({}, error), (schema ? { schema: schemaData(schema) } : {})), (error.message === 'should NOT be valid' ? { schema: schema } : {})));
83
83
  });
84
84
  };
85
85
  /**