Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 7ff7cf8

Browse files
committed
rm special characters from deployment resources gen from revision append behavior
1 parent 13b7eb8 commit 7ff7cf8

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/APIM_ARMTemplate/apimtemplate/Common/FileHandlers/FileNameGenerator.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public FileNames GenerateFileNames(string apimServiceName)
2424
public string GenerateCreatorAPIFileName(string apiName, bool isSplitAPI, bool isInitialAPI, string apimServiceName)
2525
{
2626
// in case the api name has been appended with ;rev={revisionNumber}, take only the api name initially provided by the user in the creator config
27-
string sanitizedAPIName = apiName.Split(";")[0];
27+
string sanitizedAPIName = GenerateOriginalAPIName(apiName);
2828
if (isSplitAPI == true)
2929
{
3030
return isInitialAPI == true ? $@"/{apimServiceName}-{sanitizedAPIName}-initial.api.template.json" : $@"/{apimServiceName}-{sanitizedAPIName}-subsequent.api.template.json";
@@ -39,6 +39,13 @@ public string GenerateExtractorAPIFileName(string singleAPIName, string apimServ
3939
{
4040
return singleAPIName == null ? $@"/{apimServiceName}-apis.template.json" : $@"/{apimServiceName}-{singleAPIName}-api.template.json";
4141
}
42+
43+
public string GenerateOriginalAPIName(string apiName)
44+
{
45+
// in case the api name has been appended with ;rev={revisionNumber}, take only the api name initially provided by the user in the creator config
46+
string originalName = apiName.Split(";")[0];
47+
return originalName;
48+
}
4249
}
4350

4451
public class FileNames

src/APIM_ARMTemplate/apimtemplate/Creator/TemplateCreators/MasterTemplateCreator.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ public Template CreateLinkedMasterTemplate(Template apiVersionSetTemplate,
6666
if(apiInfo.isSplit == true)
6767
{
6868
// add a deployment resource for both api template files
69-
string initialAPIDeploymentResourceName = $"{apiInfo.name}-InitialAPITemplate";
70-
string subsequentAPIDeploymentResourceName = $"{apiInfo.name}-SubsequentAPITemplate";
69+
string originalAPIName = fileNameGenerator.GenerateOriginalAPIName(apiInfo.name);
70+
string initialAPIDeploymentResourceName = $"{originalAPIName}-InitialAPITemplate";
71+
string subsequentAPIDeploymentResourceName = $"{originalAPIName}-SubsequentAPITemplate";
7172

7273
string initialAPIFileName = fileNameGenerator.GenerateCreatorAPIFileName(apiInfo.name, apiInfo.isSplit, true, apimServiceName);
7374
string initialAPIUri = $"[concat(parameters('LinkedTemplatesBaseUrl'), '{initialAPIFileName}')]";
@@ -81,7 +82,8 @@ public Template CreateLinkedMasterTemplate(Template apiVersionSetTemplate,
8182
} else
8283
{
8384
// add a deployment resource for the unified api template file
84-
string unifiedAPIDeploymentResourceName = $"{apiInfo.name}-APITemplate";
85+
string originalAPIName = fileNameGenerator.GenerateOriginalAPIName(apiInfo.name);
86+
string unifiedAPIDeploymentResourceName = $"{originalAPIName}-APITemplate";
8587
string unifiedAPIFileName = fileNameGenerator.GenerateCreatorAPIFileName(apiInfo.name, apiInfo.isSplit, true, apimServiceName);
8688
string unifiedAPIUri = $"[concat(parameters('LinkedTemplatesBaseUrl'), '{unifiedAPIFileName}')]";
8789
string[] unifiedAPIDependsOn = CreateAPIResourceDependencies(apiVersionSetTemplate, productsTemplate, loggersTemplate, backendsTemplate, authorizationServersTemplate, apiInfo);

0 commit comments

Comments
 (0)