@hestia-earth/schema-validation 27.1.0 → 28.0.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/README.md +2 -2
- package/package.json +2 -2
- package/validate.d.ts +4 -8
- package/validate.js +2 -2
package/README.md
CHANGED
package/package.json
CHANGED
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
|
-
|
|
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
|
-
|
|
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
|
|
82
|
-
return (__assign(__assign({
|
|
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
|
/**
|