@izara_project/izara-core-library-service-schemas 1.0.98 → 1.0.99
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 +1 -1
- package/src/ValidatorSchema.js +39 -24
package/package.json
CHANGED
package/src/ValidatorSchema.js
CHANGED
|
@@ -1302,34 +1302,49 @@ async function validateLocalSchema(_izContext, schemasPath, serviceConfigPath) {
|
|
|
1302
1302
|
validateStatus.status = false;
|
|
1303
1303
|
validateStatus.validateErrors.push(`${flowSchema.flowTag}.objType is invalid`)
|
|
1304
1304
|
} else {
|
|
1305
|
-
|
|
1305
|
+
|
|
1306
|
+
let dynamoDBStorageTags = [];
|
|
1307
|
+
|
|
1308
|
+
for (const [storageTag, storageResource] of Object.entries(objSchema.storageResources)) {
|
|
1309
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
1310
|
+
dynamoDBStorageTags.push(storageTag)
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
if (dynamoDBStorageTags.length > 1) {
|
|
1306
1315
|
validateStatus.status = false;
|
|
1307
|
-
validateStatus.validateErrors.push(`
|
|
1308
|
-
} else
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
}
|
|
1316
|
+
validateStatus.validateErrors.push(`objectType:${objSchema.objectType} should not shave more than 1 dynamoDB storageResource`)
|
|
1317
|
+
} else {
|
|
1318
|
+
|
|
1319
|
+
if (flowSchema.statusType === "statusField") {
|
|
1320
|
+
let specificFieldNames = Object.values(createSpecificFieldNameForCacheTable(createFlowTypeConcat(_izContext, { flowTag: flowSchema.flowTag, serviceTag: iz_serviceTag }), 'statusField'))
|
|
1321
|
+
|
|
1322
|
+
for (const specificFieldName of specificFieldNames) { // check for specific fieldName
|
|
1323
|
+
if (objSchema.fieldNames.hasOwnProperty(specificFieldName)) {
|
|
1324
|
+
if (!objSchema.fieldNames[specificFieldName].storageResourceTags.includes(dynamoDBStorageTags[0])) {
|
|
1325
|
+
validateStatus.status = false;
|
|
1326
|
+
validateStatus.validateErrors.push(`objectType: ${objSchema.objectType} fieldNames: ${specificFieldName} not have storageResourceTag: ${dynamoDBStorageTags[0]}`);
|
|
1319
1327
|
}
|
|
1320
|
-
} else
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
+
} else {
|
|
1329
|
+
validateStatus.status = false;
|
|
1330
|
+
validateStatus.validateErrors.push(`objectType: ${objSchema.objectType} not have fieldNames: ${specificFieldName} in objectSchema.fieldNames`)
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
|
|
1335
|
+
} else if (flowSchema.statusType === "storedCache" || flowSchema.statusType === "triggerCache") {
|
|
1336
|
+
let specificFieldNames = Object.values(createSpecificFieldNameForCacheTable(createFlowTypeConcat(_izContext, { flowTag: flowSchema.flowTag, serviceTag: iz_serviceTag }), "cacheTable"))
|
|
1337
|
+
|
|
1338
|
+
for (const specificFieldName of specificFieldNames) { // check for specific fieldName
|
|
1339
|
+
if (objSchema.fieldNames.hasOwnProperty(specificFieldName)) {
|
|
1340
|
+
if (!objSchema.fieldNames[specificFieldName].storageResourceTags.includes(dynamoDBStorageTags[0])) {
|
|
1341
|
+
validateStatus.status = false;
|
|
1342
|
+
validateStatus.validateErrors.push(`objectType: ${objSchema.objectType} fieldNames: ${specificFieldName} not have storageResourceTag: ${dynamoDBStorageTags[0]}`);
|
|
1328
1343
|
}
|
|
1344
|
+
} else {
|
|
1345
|
+
validateStatus.status = false;
|
|
1346
|
+
validateStatus.validateErrors.push(`objectType: ${objSchema.objectType} not have fieldNames: ${specificFieldName} in objectSchema.fieldNames`)
|
|
1329
1347
|
}
|
|
1330
|
-
} else {
|
|
1331
|
-
validateStatus.status = false;
|
|
1332
|
-
validateStatus.validateErrors.push(`storageResource of ObjectType: $${flowSchema.objType.flowTag} from flowTag: ${flowSchema.flowTag} must be dynamoDB`);
|
|
1333
1348
|
}
|
|
1334
1349
|
}
|
|
1335
1350
|
}
|