@jay-framework/plugin-validator 0.18.1 → 0.18.2
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/dist/index.js +40 -0
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -599,6 +599,46 @@ async function validateSchema(context, result) {
|
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
|
+
if (manifest.validators) {
|
|
603
|
+
if (!Array.isArray(manifest.validators)) {
|
|
604
|
+
result.errors.push({
|
|
605
|
+
type: "schema",
|
|
606
|
+
message: 'Field "validators" must be an array',
|
|
607
|
+
location: "plugin.yaml"
|
|
608
|
+
});
|
|
609
|
+
} else {
|
|
610
|
+
manifest.validators.forEach((validator, index) => {
|
|
611
|
+
if (!validator.name) {
|
|
612
|
+
result.errors.push({
|
|
613
|
+
type: "schema",
|
|
614
|
+
message: `Validator at index ${index} is missing "name" field`,
|
|
615
|
+
location: "plugin.yaml"
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
if (!validator.handler) {
|
|
619
|
+
result.errors.push({
|
|
620
|
+
type: "schema",
|
|
621
|
+
message: `Validator "${validator.name || index}" is missing "handler" field`,
|
|
622
|
+
location: "plugin.yaml",
|
|
623
|
+
suggestion: "Specify the relative path to the validator handler module"
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
if (validator.handler && !context.isNpmPackage) {
|
|
627
|
+
const handlerPath = path.join(context.pluginPath, validator.handler);
|
|
628
|
+
const extensions = ["", ".ts", ".js", "/index.ts", "/index.js"];
|
|
629
|
+
const found = extensions.some((ext) => fs.existsSync(handlerPath + ext));
|
|
630
|
+
if (!found) {
|
|
631
|
+
result.errors.push({
|
|
632
|
+
type: "file-missing",
|
|
633
|
+
message: `Validator "${validator.name}" handler not found: ${validator.handler}`,
|
|
634
|
+
location: "plugin.yaml validators",
|
|
635
|
+
suggestion: `Create the validator handler at ${handlerPath}.ts`
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
}
|
|
602
642
|
}
|
|
603
643
|
function resolveContractFile(contractSpec, context) {
|
|
604
644
|
if (context.isNpmPackage) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/plugin-validator",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "Validation tool for Jay Stack plugins",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"test:watch": ":"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@jay-framework/compiler-jay-html": "^0.18.
|
|
29
|
-
"@jay-framework/compiler-shared": "^0.18.
|
|
30
|
-
"@jay-framework/editor-protocol": "^0.18.
|
|
31
|
-
"@jay-framework/typescript-bridge": "^0.18.
|
|
28
|
+
"@jay-framework/compiler-jay-html": "^0.18.2",
|
|
29
|
+
"@jay-framework/compiler-shared": "^0.18.2",
|
|
30
|
+
"@jay-framework/editor-protocol": "^0.18.2",
|
|
31
|
+
"@jay-framework/typescript-bridge": "^0.18.2",
|
|
32
32
|
"chalk": "^4.1.2",
|
|
33
33
|
"yaml": "^2.3.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@jay-framework/dev-environment": "^0.18.
|
|
36
|
+
"@jay-framework/dev-environment": "^0.18.2",
|
|
37
37
|
"@types/node": "^22.15.21",
|
|
38
38
|
"rimraf": "^5.0.5",
|
|
39
39
|
"tsup": "^8.0.1",
|