From 857f05ba4cfebc4236425018916819756a3408db Mon Sep 17 00:00:00 2001 From: Stephen Weatherford Date: Wed, 2 Sep 2020 10:13:35 -0700 Subject: [PATCH] Rename constants --- src/constants.ts | 8 ++++---- src/documents/templates/VariableDefinition.ts | 12 ++++++------ src/documents/templates/scopes/templateScopes.ts | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 71a4ca493..3de0d0dae 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -76,10 +76,10 @@ export namespace templateKeys { export const apiProfile = 'apiProfile'; // Copy blocks - export const loopVarCopy = "copy"; - export const loopVarName = 'name'; - export const loopVarInput = 'input'; - export const loopVarCount = 'count'; + export const copyLoop = "copy"; + export const copyName = 'name'; + export const copyInput = 'input'; + export const copyCount = 'count'; // Resources export const properties = 'properties'; diff --git a/src/documents/templates/VariableDefinition.ts b/src/documents/templates/VariableDefinition.ts index cd1a5ff2b..6154e6831 100644 --- a/src/documents/templates/VariableDefinition.ts +++ b/src/documents/templates/VariableDefinition.ts @@ -99,7 +99,7 @@ export class TopLevelVariableDefinition extends VariableDefinition { return mapJsonObjectValue(valueAsObject, prop => { const arrayValue = Json.asArrayValue(prop.value); - if (!!arrayValue && prop.nameValue.unquotedValue.toLowerCase() === templateKeys.loopVarCopy) { + if (!!arrayValue && prop.nameValue.unquotedValue.toLowerCase() === templateKeys.copyLoop) { // The property is an array with the name "copy" - process it as a copy block // CONSIDER: Azure actually leaves the COPY property's value alone if all of its elements doesn't @@ -113,9 +113,9 @@ export class TopLevelVariableDefinition extends VariableDefinition { // Element has to be an object const loopVarObject = Json.asObjectValue(copyElement); if (loopVarObject) { - const name = Json.asStringValue(loopVarObject.getPropertyValue(templateKeys.loopVarName)); - const input = loopVarObject.getPropertyValue(templateKeys.loopVarInput); - const count = loopVarObject.getPropertyValue(templateKeys.loopVarCount); + const name = Json.asStringValue(loopVarObject.getPropertyValue(templateKeys.copyName)); + const input = loopVarObject.getPropertyValue(templateKeys.copyInput); + const count = loopVarObject.getPropertyValue(templateKeys.copyCount); // If both name and count are there, ARM processes this as a copy block, otherwise it considers // it to simply be a member with the name "copy". @@ -207,9 +207,9 @@ export class TopLevelCopyBlockVariableDefinition extends VariableDefinition { const asObject = Json.asObjectValue(copyVariableObject); if (asObject) { - const nameValue = Json.asStringValue(asObject.getPropertyValue(templateKeys.loopVarName)); + const nameValue = Json.asStringValue(asObject.getPropertyValue(templateKeys.copyName)); if (nameValue) { - const value = asObject.getPropertyValue(templateKeys.loopVarInput); + const value = asObject.getPropertyValue(templateKeys.copyInput); return new TopLevelCopyBlockVariableDefinition(asObject, nameValue, value); } } diff --git a/src/documents/templates/scopes/templateScopes.ts b/src/documents/templates/scopes/templateScopes.ts index fa6f4c8ef..446518e5e 100644 --- a/src/documents/templates/scopes/templateScopes.ts +++ b/src/documents/templates/scopes/templateScopes.ts @@ -113,7 +113,7 @@ function getVariableDefinitionsFromObject(objectValue: Json.ObjectValue | undefi if (variables) { const varDefs: IVariableDefinition[] = []; for (let prop of variables.properties) { - if (prop.nameValue.unquotedValue.toLowerCase() === templateKeys.loopVarCopy) { + if (prop.nameValue.unquotedValue.toLowerCase() === templateKeys.copyLoop) { // We have a top-level copy block, e.g.: // // "copy": [