@onlineapps/conn-orch-validator 2.0.10 → 2.0.12
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": "@onlineapps/conn-orch-validator",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.12",
|
|
4
4
|
"description": "Validation orchestrator for OA Drive microservices - coordinates validation across all layers (base, infra, orch, business)",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -421,13 +421,16 @@ class CookbookTestRunner {
|
|
|
421
421
|
throw new Error('Cookbook must have steps (array or object)');
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
|
|
424
|
+
// Normalize steps to array for validation
|
|
425
|
+
const stepsArray = this.normalizeSteps(cookbook.steps);
|
|
426
|
+
|
|
427
|
+
if (stepsArray.length === 0) {
|
|
425
428
|
throw new Error('Cookbook must have at least one step');
|
|
426
429
|
}
|
|
427
430
|
|
|
428
|
-
for (const step of
|
|
429
|
-
if (!step.service) throw new Error(
|
|
430
|
-
if (!step.operation) throw new Error(
|
|
431
|
+
for (const step of stepsArray) {
|
|
432
|
+
if (!step.service) throw new Error(`Step ${step.step_id || step.id || 'unknown'} must have service`);
|
|
433
|
+
if (!step.operation) throw new Error(`Step ${step.step_id || step.id || 'unknown'} must have operation`);
|
|
431
434
|
}
|
|
432
435
|
|
|
433
436
|
return true;
|
|
@@ -478,7 +478,7 @@ class ValidationOrchestrator {
|
|
|
478
478
|
}
|
|
479
479
|
} else {
|
|
480
480
|
console.error(`[ValidationOrchestrator] ❌ Validation FAILED (${duration}ms)`);
|
|
481
|
-
console.error(`[ValidationOrchestrator] Errors: ${JSON.stringify(results.errors, null, 2)}`);
|
|
481
|
+
console.error(`[ValidationOrchestrator] Errors: ${JSON.stringify(results.errors, null, 2)}(', ')}`);
|
|
482
482
|
}
|
|
483
483
|
|
|
484
484
|
return results;
|
|
@@ -159,12 +159,12 @@ class ServiceStructureValidator {
|
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
161
|
* Validate config.json structure
|
|
162
|
+
* Note: service.version is now read from package.json (Single Source of Truth)
|
|
162
163
|
*/
|
|
163
164
|
validateConfigStructure(config) {
|
|
164
|
-
// Required fields
|
|
165
|
+
// Required fields (version comes from package.json, not config.json)
|
|
165
166
|
const requiredFields = [
|
|
166
167
|
'service.name',
|
|
167
|
-
'service.version',
|
|
168
168
|
'service.port'
|
|
169
169
|
];
|
|
170
170
|
|
|
@@ -200,18 +200,23 @@ class ServiceStructureValidator {
|
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
// Validate version format
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
// Validate version format from package.json (Single Source of Truth)
|
|
204
|
+
const packagePath = path.join(this.serviceRoot, 'package.json');
|
|
205
|
+
try {
|
|
206
|
+
const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
|
|
207
|
+
const version = pkg.version;
|
|
208
|
+
if (version && !/^\d+\.\d+\.\d+$/.test(version)) {
|
|
206
209
|
this.warnings.push({
|
|
207
210
|
type: 'INVALID_VERSION',
|
|
208
|
-
path: '
|
|
209
|
-
field: '
|
|
210
|
-
value:
|
|
211
|
-
message: `Version should follow semantic versioning: ${
|
|
211
|
+
path: 'package.json',
|
|
212
|
+
field: 'version',
|
|
213
|
+
value: version,
|
|
214
|
+
message: `Version should follow semantic versioning: ${version}`,
|
|
212
215
|
fix: 'Use format: MAJOR.MINOR.PATCH (e.g., "1.0.0")'
|
|
213
216
|
});
|
|
214
217
|
}
|
|
218
|
+
} catch (e) {
|
|
219
|
+
// package.json validation is done separately
|
|
215
220
|
}
|
|
216
221
|
}
|
|
217
222
|
|