@onlineapps/conn-orch-validator 2.0.11 → 2.0.13
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.13",
|
|
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": {
|
|
@@ -278,7 +278,7 @@ class ValidationOrchestrator {
|
|
|
278
278
|
} else {
|
|
279
279
|
const config = JSON.parse(fs.readFileSync(configFile, 'utf8'));
|
|
280
280
|
if (!config.service?.name) errors.push('config.json missing service.name');
|
|
281
|
-
|
|
281
|
+
// Note: service.version is now read from package.json (Single Source of Truth)
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
// Validate operations.json
|
|
@@ -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
|
|