From a0b0dcfb4dcda44ffe519c903bce2f2fdb0d7985 Mon Sep 17 00:00:00 2001 From: Vailorium Date: Mon, 1 Aug 2022 13:04:00 +1200 Subject: [PATCH 1/9] added Variant field to reviews and codefiles for different language variants --- src/dotnet/APIView/APIView/Model/CodeFile.cs | 2 + .../APIViewWeb/Models/ReviewCodeFileModel.cs | 5 +- .../APIView/APIViewWeb/Models/ReviewModel.cs | 3 ++ .../APIViewWeb/Pages/Assemblies/Review.cshtml | 18 ++++++- .../Pages/Shared/_ReviewsPartial.cshtml | 18 ++++++- .../APIViewWeb/Repositories/ReviewManager.cs | 1 + .../wwwroot/icons/java-android-original.svg | 54 +++++++++++++++++++ .../wwwroot/icons/java-spring-original.svg | 1 + 8 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 src/dotnet/APIView/APIViewWeb/wwwroot/icons/java-android-original.svg create mode 100644 src/dotnet/APIView/APIViewWeb/wwwroot/icons/java-spring-original.svg diff --git a/src/dotnet/APIView/APIView/Model/CodeFile.cs b/src/dotnet/APIView/APIView/Model/CodeFile.cs index 3b3f2430d05..b44089d8fe1 100644 --- a/src/dotnet/APIView/APIView/Model/CodeFile.cs +++ b/src/dotnet/APIView/APIView/Model/CodeFile.cs @@ -34,6 +34,8 @@ public string VersionString public string Language { get; set; } + public string Variant { get; set; } + public string PackageName { get; set; } public string ServiceName { get; set; } diff --git a/src/dotnet/APIView/APIViewWeb/Models/ReviewCodeFileModel.cs b/src/dotnet/APIView/APIViewWeb/Models/ReviewCodeFileModel.cs index e32a30dcde5..4c0469ec51a 100644 --- a/src/dotnet/APIView/APIViewWeb/Models/ReviewCodeFileModel.cs +++ b/src/dotnet/APIView/APIViewWeb/Models/ReviewCodeFileModel.cs @@ -14,7 +14,6 @@ public class ReviewCodeFileModel // This is field is more of a display name. It is set to name value returned by parser which has package name and version in following format // Package name ( Version ) public string Name { get; set; } - public string Language { get => _language ?? (Name.EndsWith(".json", StringComparison.OrdinalIgnoreCase) ? "Json" : "C#"); @@ -23,6 +22,8 @@ public string Language public string VersionString { get; set; } + public string Variant { get; set; } + public bool HasOriginal { get; set; } public DateTime CreationDate { get; set; } = DateTime.Now; @@ -36,4 +37,4 @@ public string Language // This field stores original file name uploaded to create review public string FileName { get; set; } } -} \ No newline at end of file +} diff --git a/src/dotnet/APIView/APIViewWeb/Models/ReviewModel.cs b/src/dotnet/APIView/APIViewWeb/Models/ReviewModel.cs index b25258b3ba5..3839579d0b6 100644 --- a/src/dotnet/APIView/APIViewWeb/Models/ReviewModel.cs +++ b/src/dotnet/APIView/APIViewWeb/Models/ReviewModel.cs @@ -78,6 +78,9 @@ public string DisplayName [JsonIgnore] public string Language => Revisions.LastOrDefault()?.Files.LastOrDefault()?.Language; + [JsonIgnore] + public string Variant => Revisions.LastOrDefault()?.Files.LastOrDefault()?.Variant; + [JsonIgnore] public string PackageName { get diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml index eb1acb4f29d..d2fef31e1b9 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml +++ b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml @@ -38,7 +38,23 @@ @Model.Review.Language break; case "java": - @Model.Review.Language + if(@Model.Review.Variant != null){ + switch(@Model.Review.Variant.ToLower()) + { + case "spring": + @Model.Review.Language + break; + case "android": + @Model.Review.Language + break; + default: + @Model.Review.Language + break; + } + } else + { + @Model.Review.Language + } break; case "swift": @Model.Review.Language diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml index a619480e467..413809ab9b0 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml +++ b/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml @@ -46,7 +46,23 @@ @review.Language break; case "java": - @review.Language + if(@review.Variant != null){ + switch(@review.Variant.ToLower()) + { + case "spring": + @review.Language + break; + case "android": + @review.Language + break; + default: + @review.Language + break; + } + } else + { + @review.Language + } break; case "swift": @review.Language diff --git a/src/dotnet/APIView/APIViewWeb/Repositories/ReviewManager.cs b/src/dotnet/APIView/APIViewWeb/Repositories/ReviewManager.cs index e65a0251af8..e7ff13338c9 100644 --- a/src/dotnet/APIView/APIViewWeb/Repositories/ReviewManager.cs +++ b/src/dotnet/APIView/APIViewWeb/Repositories/ReviewManager.cs @@ -345,6 +345,7 @@ public async Task ToggleIsClosedAsync(ClaimsPrincipal user, string id) private void InitializeFromCodeFile(ReviewCodeFileModel file, CodeFile codeFile) { file.Language = codeFile.Language; + file.Variant = codeFile.Variant; file.VersionString = codeFile.VersionString; file.Name = codeFile.Name; file.PackageName = codeFile.PackageName; diff --git a/src/dotnet/APIView/APIViewWeb/wwwroot/icons/java-android-original.svg b/src/dotnet/APIView/APIViewWeb/wwwroot/icons/java-android-original.svg new file mode 100644 index 00000000000..8cb02410427 --- /dev/null +++ b/src/dotnet/APIView/APIViewWeb/wwwroot/icons/java-android-original.svg @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/dotnet/APIView/APIViewWeb/wwwroot/icons/java-spring-original.svg b/src/dotnet/APIView/APIViewWeb/wwwroot/icons/java-spring-original.svg new file mode 100644 index 00000000000..bcc0f7cb597 --- /dev/null +++ b/src/dotnet/APIView/APIViewWeb/wwwroot/icons/java-spring-original.svg @@ -0,0 +1 @@ +spring-icon \ No newline at end of file From f75dd2cc85420406b79cbbc74a66af942daf84a2 Mon Sep 17 00:00:00 2001 From: Vailorium Date: Mon, 1 Aug 2022 13:22:21 +1200 Subject: [PATCH 2/9] added basic java variant detection based on package name --- .../java/com/azure/tools/apiview/processor/Main.java | 9 +++++++++ .../tools/apiview/processor/model/APIListing.java | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java index cd095f34a3c..97d07f76437 100644 --- a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java +++ b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java @@ -157,6 +157,15 @@ private static void processJavaSourcesJar(File inputFile, APIListing apiListing) apiListing.setLanguage("Java"); apiListing.setMavenPom(reviewProperties.getMavenPom()); + if(packageName.indexOf("spring") > -1) { + apiListing.setVariant("Spring"); + } else if(packageName.indexOf("android") > -1) { + apiListing.setVariant("Android"); + } else { + apiListing.setVariant("Default"); + } + System.out.println(" Using '" + apiListing.getVariant() + "' for the language variant"); + final Analyser analyser = new JavaASTAnalyser(inputFile, apiListing); // Read all files within the jar file so that we can create a list of files to analyse diff --git a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/APIListing.java b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/APIListing.java index 8af0678f7e5..679261e89df 100644 --- a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/APIListing.java +++ b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/APIListing.java @@ -23,6 +23,9 @@ public class APIListing { @JsonProperty("Language") private String language; + @JsonProperty("Variant") + private String variant; + @JsonProperty("PackageName") private String packageName; @@ -91,6 +94,14 @@ public void setLanguage(final String language) { this.language = language; } + public String getVariant() { + return variant; + } + + public void setVariant(final String variant) { + this.variant = variant; + } + public String getPackageName() { return packageName; } From 00d991115e57b0a830b84c26cbebf8938bbf96bf Mon Sep 17 00:00:00 2001 From: Vailorium Date: Mon, 1 Aug 2022 13:52:15 +1200 Subject: [PATCH 3/9] add java variant icon next to language icon --- .../APIViewWeb/Pages/Assemblies/Review.cshtml | 14 ++++++-------- .../APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml index d2fef31e1b9..5a61143af46 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml +++ b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml @@ -38,22 +38,20 @@ @Model.Review.Language break; case "java": - if(@Model.Review.Variant != null){ - switch(@Model.Review.Variant.ToLower()) + @Model.Review.Language + @if(@Model.Review.Variant != null) + { + @switch(@Model.Review.Variant.ToLower()) { case "spring": - @Model.Review.Language + @Model.Review.Variant break; case "android": - @Model.Review.Language + @Model.Review.Variant break; default: - @Model.Review.Language break; } - } else - { - @Model.Review.Language } break; case "swift": diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml index 413809ab9b0..9c6c7bd1601 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml +++ b/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml @@ -46,22 +46,20 @@ @review.Language break; case "java": - if(@review.Variant != null){ - switch(@review.Variant.ToLower()) + @review.Language + @if(@review.Variant != null) + { + @switch(@review.Variant.ToLower()) { case "spring": - @review.Language + @review.Variant break; case "android": - @review.Language + @review.Variant break; default: - @review.Language break; } - } else - { - @review.Language } break; case "swift": From 63ee9f14bf1bcd34cdfc4276db446edbf8326b80 Mon Sep 17 00:00:00 2001 From: Vailorium Date: Mon, 1 Aug 2022 14:40:36 +1200 Subject: [PATCH 4/9] replaced java variant string with enum --- .../main/java/com/azure/tools/apiview/processor/Main.java | 7 ++++--- .../azure/tools/apiview/processor/model/APIListing.java | 6 +++--- .../tools/apiview/processor/model/LanguageVariant.java | 7 +++++++ 3 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/LanguageVariant.java diff --git a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java index 97d07f76437..5333d5d2082 100644 --- a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java +++ b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java @@ -6,6 +6,7 @@ import com.azure.tools.apiview.processor.model.APIListing; import com.azure.tools.apiview.processor.model.Diagnostic; import com.azure.tools.apiview.processor.model.DiagnosticKind; +import com.azure.tools.apiview.processor.model.LanguageVariant; import com.azure.tools.apiview.processor.model.Token; import com.azure.tools.apiview.processor.model.maven.Pom; import com.fasterxml.jackson.annotation.JsonInclude; @@ -158,11 +159,11 @@ private static void processJavaSourcesJar(File inputFile, APIListing apiListing) apiListing.setMavenPom(reviewProperties.getMavenPom()); if(packageName.indexOf("spring") > -1) { - apiListing.setVariant("Spring"); + apiListing.setVariant(LanguageVariant.Spring); } else if(packageName.indexOf("android") > -1) { - apiListing.setVariant("Android"); + apiListing.setVariant(LanguageVariant.Android); } else { - apiListing.setVariant("Default"); + apiListing.setVariant(LanguageVariant.Default); } System.out.println(" Using '" + apiListing.getVariant() + "' for the language variant"); diff --git a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/APIListing.java b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/APIListing.java index 679261e89df..ea41b9f76ae 100644 --- a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/APIListing.java +++ b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/APIListing.java @@ -24,7 +24,7 @@ public class APIListing { private String language; @JsonProperty("Variant") - private String variant; + private LanguageVariant variant; @JsonProperty("PackageName") private String packageName; @@ -94,11 +94,11 @@ public void setLanguage(final String language) { this.language = language; } - public String getVariant() { + public LanguageVariant getVariant() { return variant; } - public void setVariant(final String variant) { + public void setVariant(final LanguageVariant variant) { this.variant = variant; } diff --git a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/LanguageVariant.java b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/LanguageVariant.java new file mode 100644 index 00000000000..79d36f77cbf --- /dev/null +++ b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/LanguageVariant.java @@ -0,0 +1,7 @@ +package com.azure.tools.apiview.processor.model; + +public enum LanguageVariant { + Default, + Spring, + Android, +} From 0c4c810ee965d122315f02e5125016ee64f98e9a Mon Sep 17 00:00:00 2001 From: Vailorium Date: Mon, 1 Aug 2022 15:18:15 +1200 Subject: [PATCH 5/9] Replace language icon with variant if variant exists --- .../APIViewWeb/Pages/Assemblies/Review.cshtml | 13 ++++++++----- .../APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml index 5a61143af46..80b8fc3094a 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml +++ b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml @@ -38,20 +38,23 @@ @Model.Review.Language break; case "java": - @Model.Review.Language - @if(@Model.Review.Variant != null) + if(@Model.Review.Variant != null) { - @switch(@Model.Review.Variant.ToLower()) + switch(@Model.Review.Variant.ToLower()) { case "spring": - @Model.Review.Variant + @Model.Review.Language @Model.Review.Variant break; case "android": - @Model.Review.Variant + @Model.Review.Language @Model.Review.Variant break; default: + @Model.Review.Language break; } + } else + { + @Model.Review.Language } break; case "swift": diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml index 9c6c7bd1601..8510263a117 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml +++ b/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml @@ -46,20 +46,23 @@ @review.Language break; case "java": - @review.Language - @if(@review.Variant != null) + if(@review.Variant != null) { - @switch(@review.Variant.ToLower()) + switch(@review.Variant.ToLower()) { case "spring": - @review.Variant + @review.Language @review.Variant break; case "android": - @review.Variant + @review.Language @review.Variant break; default: + @review.Language break; } + } else + { + @review.Language } break; case "swift": From bb181bf667c7701c8b05773f0523204f1d871ab9 Mon Sep 17 00:00:00 2001 From: Vailorium Date: Mon, 1 Aug 2022 15:19:21 +1200 Subject: [PATCH 6/9] Capitalize java LanguageVariant enum values, added variantName value --- .../azure/tools/apiview/processor/Main.java | 10 +++++----- .../processor/model/LanguageVariant.java | 20 ++++++++++++++++--- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java index 5333d5d2082..396c8718ddc 100644 --- a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java +++ b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java @@ -158,12 +158,12 @@ private static void processJavaSourcesJar(File inputFile, APIListing apiListing) apiListing.setLanguage("Java"); apiListing.setMavenPom(reviewProperties.getMavenPom()); - if(packageName.indexOf("spring") > -1) { - apiListing.setVariant(LanguageVariant.Spring); - } else if(packageName.indexOf("android") > -1) { - apiListing.setVariant(LanguageVariant.Android); + if(packageName.contains("spring")) { + apiListing.setVariant(LanguageVariant.SPRING); + } else if(packageName.contains("android")) { + apiListing.setVariant(LanguageVariant.ANDROID); } else { - apiListing.setVariant(LanguageVariant.Default); + apiListing.setVariant(LanguageVariant.DEFAULT); } System.out.println(" Using '" + apiListing.getVariant() + "' for the language variant"); diff --git a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/LanguageVariant.java b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/LanguageVariant.java index 79d36f77cbf..329e2e82716 100644 --- a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/LanguageVariant.java +++ b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/LanguageVariant.java @@ -1,7 +1,21 @@ package com.azure.tools.apiview.processor.model; +import com.fasterxml.jackson.annotation.JsonValue; + public enum LanguageVariant { - Default, - Spring, - Android, + DEFAULT("Default"), + SPRING("Spring"), + ANDROID("Android"); + + private final String variantName; + + LanguageVariant(String name) { + this.variantName = name; + } + + @Override + @JsonValue + public String toString() { + return this.variantName; + } } From 87122ed2a008a2756109ec88efed93757e75058c Mon Sep 17 00:00:00 2001 From: Vailorium Date: Mon, 1 Aug 2022 17:21:46 +1200 Subject: [PATCH 7/9] fix conditional placement for java variant icons --- src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml | 3 ++- .../APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml index 80b8fc3094a..cceade32066 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml +++ b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml @@ -52,7 +52,8 @@ @Model.Review.Language break; } - } else + } + else { @Model.Review.Language } diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml index 8510263a117..096a4211522 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml +++ b/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml @@ -60,7 +60,8 @@ @review.Language break; } - } else + } + else { @review.Language } From bb955888de6a000c4fdfde86c0755237a5c111ea Mon Sep 17 00:00:00 2001 From: Vailorium Date: Tue, 2 Aug 2022 11:54:16 +1200 Subject: [PATCH 8/9] add variant to review page alt text --- src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml index b156f4caea1..872ef48218c 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml +++ b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml @@ -67,11 +67,11 @@ } if (String.IsNullOrEmpty(imageSource)) { - @Model.Review.Language + @Model.Review.Language @Model.Review.Variant } else { - @Model.Review.Language + @Model.Review.Language @Model.Review.Variant } }

From 941a8def93b37663c96eea4fc8a1f7ac67b63778 Mon Sep 17 00:00:00 2001 From: Vailorium Date: Tue, 2 Aug 2022 12:40:57 +1200 Subject: [PATCH 9/9] change Variant to LanguageVariant, base java variant on groupId instead of packageName --- src/dotnet/APIView/APIView/Model/CodeFile.cs | 2 +- .../APIView/APIViewWeb/Models/ReviewCodeFileModel.cs | 2 +- src/dotnet/APIView/APIViewWeb/Models/ReviewModel.cs | 2 +- .../APIViewWeb/Pages/Assemblies/Review.cshtml | 8 ++++---- .../APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml | 8 ++++---- .../APIView/APIViewWeb/Repositories/ReviewManager.cs | 2 +- .../java/com/azure/tools/apiview/processor/Main.java | 12 ++++++------ .../tools/apiview/processor/model/APIListing.java | 12 ++++++------ 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/dotnet/APIView/APIView/Model/CodeFile.cs b/src/dotnet/APIView/APIView/Model/CodeFile.cs index b44089d8fe1..131785c5431 100644 --- a/src/dotnet/APIView/APIView/Model/CodeFile.cs +++ b/src/dotnet/APIView/APIView/Model/CodeFile.cs @@ -34,7 +34,7 @@ public string VersionString public string Language { get; set; } - public string Variant { get; set; } + public string LanguageVariant { get; set; } public string PackageName { get; set; } diff --git a/src/dotnet/APIView/APIViewWeb/Models/ReviewCodeFileModel.cs b/src/dotnet/APIView/APIViewWeb/Models/ReviewCodeFileModel.cs index 4c0469ec51a..b0b8090d530 100644 --- a/src/dotnet/APIView/APIViewWeb/Models/ReviewCodeFileModel.cs +++ b/src/dotnet/APIView/APIViewWeb/Models/ReviewCodeFileModel.cs @@ -22,7 +22,7 @@ public string Language public string VersionString { get; set; } - public string Variant { get; set; } + public string LanguageVariant { get; set; } public bool HasOriginal { get; set; } diff --git a/src/dotnet/APIView/APIViewWeb/Models/ReviewModel.cs b/src/dotnet/APIView/APIViewWeb/Models/ReviewModel.cs index 3839579d0b6..e3b7149930a 100644 --- a/src/dotnet/APIView/APIViewWeb/Models/ReviewModel.cs +++ b/src/dotnet/APIView/APIViewWeb/Models/ReviewModel.cs @@ -79,7 +79,7 @@ public string DisplayName public string Language => Revisions.LastOrDefault()?.Files.LastOrDefault()?.Language; [JsonIgnore] - public string Variant => Revisions.LastOrDefault()?.Files.LastOrDefault()?.Variant; + public string LanguageVariant => Revisions.LastOrDefault()?.Files.LastOrDefault()?.LanguageVariant; [JsonIgnore] public string PackageName { diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml index 872ef48218c..dd87ce95789 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml +++ b/src/dotnet/APIView/APIViewWeb/Pages/Assemblies/Review.cshtml @@ -32,9 +32,9 @@ imageSource = "icons/go-original.svg"; break; case "java": - if(@Model.Review.Variant != null) + if(@Model.Review.LanguageVariant != null) { - switch(@Model.Review.Variant.ToLower()) + switch(@Model.Review.LanguageVariant.ToLower()) { case "spring": imageSource = "icons/java-spring-original.svg"; @@ -67,11 +67,11 @@ } if (String.IsNullOrEmpty(imageSource)) { - @Model.Review.Language @Model.Review.Variant + @Model.Review.Language @Model.Review.LanguageVariant } else { - @Model.Review.Language @Model.Review.Variant + @Model.Review.Language @Model.Review.LanguageVariant } }

diff --git a/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml b/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml index 096a4211522..71fc2aa5ed7 100644 --- a/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml +++ b/src/dotnet/APIView/APIViewWeb/Pages/Shared/_ReviewsPartial.cshtml @@ -46,15 +46,15 @@ @review.Language break; case "java": - if(@review.Variant != null) + if(@review.LanguageVariant != null) { - switch(@review.Variant.ToLower()) + switch(@review.LanguageVariant.ToLower()) { case "spring": - @review.Language @review.Variant + @review.Language @review.LanguageVariant break; case "android": - @review.Language @review.Variant + @review.Language @review.LanguageVariant break; default: @review.Language diff --git a/src/dotnet/APIView/APIViewWeb/Repositories/ReviewManager.cs b/src/dotnet/APIView/APIViewWeb/Repositories/ReviewManager.cs index bd1496b228c..8153dc26856 100644 --- a/src/dotnet/APIView/APIViewWeb/Repositories/ReviewManager.cs +++ b/src/dotnet/APIView/APIViewWeb/Repositories/ReviewManager.cs @@ -361,7 +361,7 @@ public async Task ToggleIsClosedAsync(ClaimsPrincipal user, string id) private void InitializeFromCodeFile(ReviewCodeFileModel file, CodeFile codeFile) { file.Language = codeFile.Language; - file.Variant = codeFile.Variant; + file.LanguageVariant = codeFile.LanguageVariant; file.VersionString = codeFile.VersionString; file.Name = codeFile.Name; file.PackageName = codeFile.PackageName; diff --git a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java index 396c8718ddc..9ae7b9dbdbe 100644 --- a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java +++ b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/Main.java @@ -158,14 +158,14 @@ private static void processJavaSourcesJar(File inputFile, APIListing apiListing) apiListing.setLanguage("Java"); apiListing.setMavenPom(reviewProperties.getMavenPom()); - if(packageName.contains("spring")) { - apiListing.setVariant(LanguageVariant.SPRING); - } else if(packageName.contains("android")) { - apiListing.setVariant(LanguageVariant.ANDROID); + if(groupId.contains("spring")) { + apiListing.setLanguageVariant(LanguageVariant.SPRING); + } else if(groupId.contains("android")) { + apiListing.setLanguageVariant(LanguageVariant.ANDROID); } else { - apiListing.setVariant(LanguageVariant.DEFAULT); + apiListing.setLanguageVariant(LanguageVariant.DEFAULT); } - System.out.println(" Using '" + apiListing.getVariant() + "' for the language variant"); + System.out.println(" Using '" + apiListing.getLanguageVariant() + "' for the language variant"); final Analyser analyser = new JavaASTAnalyser(inputFile, apiListing); diff --git a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/APIListing.java b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/APIListing.java index ea41b9f76ae..022d15f0303 100644 --- a/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/APIListing.java +++ b/src/java/apiview-java-processor/src/main/java/com/azure/tools/apiview/processor/model/APIListing.java @@ -23,8 +23,8 @@ public class APIListing { @JsonProperty("Language") private String language; - @JsonProperty("Variant") - private LanguageVariant variant; + @JsonProperty("LanguageVariant") + private LanguageVariant languageVariant; @JsonProperty("PackageName") private String packageName; @@ -94,12 +94,12 @@ public void setLanguage(final String language) { this.language = language; } - public LanguageVariant getVariant() { - return variant; + public LanguageVariant getLanguageVariant() { + return languageVariant; } - public void setVariant(final LanguageVariant variant) { - this.variant = variant; + public void setLanguageVariant(final LanguageVariant variant) { + this.languageVariant = variant; } public String getPackageName() {