Skip to content

Commit 6d5d1a9

Browse files
Update Composer/packages/lib/indexers/src/validations/expressionValidation/index.ts
Co-authored-by: Joel Mut <[email protected]>
1 parent 8daf5ce commit 6d5d1a9

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

Composer/packages/lib/indexers/src/validations/expressionValidation/index.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ export const validateExpressions: ValidateFunc = (
4949
let errorMessage = '';
5050
let warningMessage = '';
5151
try {
52-
//the cacheKey adds the type of the value at the end, this allows a new indexing system to prevent the overwriting in cache
53-
const cacheKey = types.length > 1 ? value : `${value}.${types[0]}`;
54-
newCache[cacheKey] = cache?.[cacheKey] ? cache[cacheKey] : checkExpression(value, required, types);
55-
errorMessage = checkReturnType(newCache[cacheKey], types);
52+
const valueToValidate = cache?.[path] ? cache[path] : checkExpression(value, required, types)
53+
errorMessage = checkReturnType(valueToValidate, types);
54+
if (!errorMessage) {
55+
//First validate that the types of the value match and then store the type value in newCache using the path as key to avoid overwriting.
56+
newCache[path] = valueToValidate;
57+
}
5658
} catch (error) {
5759
//change the missing custom function error to warning
5860
warningMessage = filterCustomFunctionError(error.message, customFunctions);

extensions/azurePublish/yarn-berry.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1896,7 +1896,7 @@ __metadata:
18961896

18971897
"@bfc/indexers@file:../../Composer/packages/lib/indexers::locator=azurePublish%40workspace%3A.":
18981898
version: 0.0.0
1899-
resolution: "@bfc/indexers@file:../../Composer/packages/lib/indexers#../../Composer/packages/lib/indexers::hash=99ba57&locator=azurePublish%40workspace%3A."
1899+
resolution: "@bfc/indexers@file:../../Composer/packages/lib/indexers#../../Composer/packages/lib/indexers::hash=52caad&locator=azurePublish%40workspace%3A."
19001900
dependencies:
19011901
"@microsoft/bf-lu": 4.15.0-dev.20210702.cbf708d
19021902
adaptive-expressions: ^4.18.0
@@ -1905,7 +1905,7 @@ __metadata:
19051905
tslib: 2.4.0
19061906
peerDependencies:
19071907
"@bfc/shared": "*"
1908-
checksum: 5a2aab3716adf348a98496dd60f07dacb492f8d4e5e393b6cee28d0f39ae5291f5985c4e64f549dde184ec3d49a4a531c1963de19278b89497966fd2fce4373f
1908+
checksum: 1e0e72e94ee93ca43e97cf7d4a4bad2ac9bddd32308c4c596966c1fda9ae712812ba27c2f76f72efae37160d04d1a349fbe09bc889a3858e52e493b77f7e1a5a
19091909
languageName: node
19101910
linkType: hard
19111911

extensions/azurePublishNew/yarn-berry.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1936,7 +1936,7 @@ __metadata:
19361936

19371937
"@bfc/indexers@file:../../Composer/packages/lib/indexers::locator=azure-publish-new%40workspace%3A.":
19381938
version: 0.0.0
1939-
resolution: "@bfc/indexers@file:../../Composer/packages/lib/indexers#../../Composer/packages/lib/indexers::hash=99ba57&locator=azure-publish-new%40workspace%3A."
1939+
resolution: "@bfc/indexers@file:../../Composer/packages/lib/indexers#../../Composer/packages/lib/indexers::hash=52caad&locator=azure-publish-new%40workspace%3A."
19401940
dependencies:
19411941
"@microsoft/bf-lu": 4.15.0-dev.20210702.cbf708d
19421942
adaptive-expressions: ^4.18.0
@@ -1945,7 +1945,7 @@ __metadata:
19451945
tslib: 2.4.0
19461946
peerDependencies:
19471947
"@bfc/shared": "*"
1948-
checksum: 5a2aab3716adf348a98496dd60f07dacb492f8d4e5e393b6cee28d0f39ae5291f5985c4e64f549dde184ec3d49a4a531c1963de19278b89497966fd2fce4373f
1948+
checksum: 1e0e72e94ee93ca43e97cf7d4a4bad2ac9bddd32308c4c596966c1fda9ae712812ba27c2f76f72efae37160d04d1a349fbe09bc889a3858e52e493b77f7e1a5a
19491949
languageName: node
19501950
linkType: hard
19511951

0 commit comments

Comments
 (0)