@onlineapps/service-validator-core 1.0.5 → 1.0.6

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/service-validator-core",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Core validation logic for microservices",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -56,18 +56,35 @@ class FingerprintUtils {
56
56
  * Used for cache validation - skip re-validation if config unchanged
57
57
  *
58
58
  * @param {Object} config - Service configuration
59
- * @param {string} config.version - Service version
60
- * @param {Array} config.endpoints - API endpoints
61
- * @param {Object} config.metadata - Service metadata
62
- * @param {string} config.health - Health check endpoint
59
+ * @param {string} config.version - Service version (REQUIRED)
60
+ * @param {Array} config.endpoints - API endpoints (REQUIRED)
61
+ * @param {Object} config.metadata - Service metadata (REQUIRED)
62
+ * @param {string} config.health - Health check endpoint (REQUIRED)
63
63
  * @returns {string} Configuration fingerprint
64
+ * @throws {Error} If any required field is missing
64
65
  */
65
66
  static generateConfigFingerprint(config) {
67
+ if (!config) {
68
+ throw new Error('Config is required for generateConfigFingerprint');
69
+ }
70
+ if (!config.version) {
71
+ throw new Error('config.version is required');
72
+ }
73
+ if (!Array.isArray(config.endpoints)) {
74
+ throw new Error('config.endpoints must be an array');
75
+ }
76
+ if (typeof config.metadata !== 'object' || config.metadata === null) {
77
+ throw new Error('config.metadata must be an object');
78
+ }
79
+ if (!config.health) {
80
+ throw new Error('config.health is required');
81
+ }
82
+
66
83
  return this.generate({
67
84
  version: config.version,
68
- endpoints: config.endpoints || [],
69
- metadata: config.metadata || {},
70
- health: config.health || '/health'
85
+ endpoints: config.endpoints,
86
+ metadata: config.metadata,
87
+ health: config.health
71
88
  });
72
89
  }
73
90