@chain-registry/workflows 1.42.0 → 1.43.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/esm/validator.js +14 -8
- package/package.json +3 -3
- package/validator.js +14 -8
package/esm/validator.js
CHANGED
|
@@ -18,15 +18,21 @@ export class SchemaValidator {
|
|
|
18
18
|
// Compile and validate each schema, then validate corresponding data
|
|
19
19
|
this.registry.forEachSchemas(([title, schema]) => {
|
|
20
20
|
schema.content.$schema = 'https://json-schema.org/draft/2019-09/schema';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
try {
|
|
22
|
+
const validate = this.ajv.compile(schema.content);
|
|
23
|
+
const dataMap = this.registry.dataMappings[title];
|
|
24
|
+
if (!dataMap) {
|
|
25
|
+
console.error(chalk.yellow(`⚠️ No data found for schema titled ${chalk.bold(title)}`));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
dataMap.forEach(data => {
|
|
29
|
+
this.validateJsonSchema(data, title, validate, verbose);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
console.error(chalk.red(`❌ Strict Validation errors for schema ${chalk.bold(title)} in file ${chalk.magenta(schema.path)}:`));
|
|
34
|
+
throw e;
|
|
26
35
|
}
|
|
27
|
-
dataMap.forEach(data => {
|
|
28
|
-
this.validateJsonSchema(data, title, validate, verbose);
|
|
29
|
-
});
|
|
30
36
|
});
|
|
31
37
|
}
|
|
32
38
|
validateJsonSchema(data, title, validate, verbose) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chain-registry/workflows",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0",
|
|
4
4
|
"description": "Chain Registry Workflows",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/cosmology-tech/chain-registry",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@types/sha.js": "^2.4.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@chain-registry/interfaces": "^0.
|
|
34
|
+
"@chain-registry/interfaces": "^0.42.0",
|
|
35
35
|
"ajv": "^8.12.0",
|
|
36
36
|
"ajv-formats": "^3.0.1",
|
|
37
37
|
"bignumber.js": "9.1.2",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"cosmos",
|
|
52
52
|
"interchain"
|
|
53
53
|
],
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "9aff67535f11998b742af7a345b00bd7bdda9332"
|
|
55
55
|
}
|
package/validator.js
CHANGED
|
@@ -24,15 +24,21 @@ class SchemaValidator {
|
|
|
24
24
|
// Compile and validate each schema, then validate corresponding data
|
|
25
25
|
this.registry.forEachSchemas(([title, schema]) => {
|
|
26
26
|
schema.content.$schema = 'https://json-schema.org/draft/2019-09/schema';
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
try {
|
|
28
|
+
const validate = this.ajv.compile(schema.content);
|
|
29
|
+
const dataMap = this.registry.dataMappings[title];
|
|
30
|
+
if (!dataMap) {
|
|
31
|
+
console.error(chalk_1.default.yellow(`⚠️ No data found for schema titled ${chalk_1.default.bold(title)}`));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
dataMap.forEach(data => {
|
|
35
|
+
this.validateJsonSchema(data, title, validate, verbose);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
console.error(chalk_1.default.red(`❌ Strict Validation errors for schema ${chalk_1.default.bold(title)} in file ${chalk_1.default.magenta(schema.path)}:`));
|
|
40
|
+
throw e;
|
|
32
41
|
}
|
|
33
|
-
dataMap.forEach(data => {
|
|
34
|
-
this.validateJsonSchema(data, title, validate, verbose);
|
|
35
|
-
});
|
|
36
42
|
});
|
|
37
43
|
}
|
|
38
44
|
validateJsonSchema(data, title, validate, verbose) {
|