diff --git a/CHANGELOG.md b/CHANGELOG.md index 7649b49a9c..d18de8d052 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added a notion of support experience for languages in preparation for new community implemented languages. + ### Changed - Fixed python generation in scenarios with opening/closing tags for code comments. [#5636](https://github.com/microsoft/kiota/issues/5636) @@ -154,7 +156,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added uri-form encoded serialization for PHP. [#2074](https://github.com/microsoft/kiota/issues/2074) - Added information message with base URL in the CLI experience. [#4635](https://github.com/microsoft/kiota/issues/4635) - Added optional parameter --disable-ssl-validation for generate, show, and download commands. [#4176](https://github.com/microsoft/kiota/issues/4176) -- For _Debug_ builds of kiota, the `--log-level` / `--ll` option is now observed if specified explicitly on the command line. It still defaults to `Debug` for _Debug_ builds and `Warning` for _Release_ builds. [#4739](https://github.com/microsoft/kiota/pull/4739) +- For *Debug* builds of kiota, the `--log-level` / `--ll` option is now observed if specified explicitly on the command line. It still defaults to `Debug` for *Debug* builds and `Warning` for *Release* builds. [#4739](https://github.com/microsoft/kiota/pull/4739) ### Changed @@ -756,7 +758,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed unused generated import for PHP Generation. - Fixed a bug where long namespaces would make Ruby packaging fail. - Fixed a bug where classes with namespace names are generated outside namespace in Python. [#2188](https://github.com/microsoft/kiota/issues/2188) -- Changed signature of escaped reserved names from {x}_escaped to {x}_ in line with Python style guides. +- Changed signature of escaped reserved names from {x}*escaped to {x}* in line with Python style guides. - Add null checks in generated Shell language code. - Fixed a bug where Go indexers would fail to pass the index parameter. - Fixed a bug where path segments with parameters could be missing words. [#2209](https://github.com/microsoft/kiota/issues/2209) @@ -1505,4 +1507,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Initial GitHub release - diff --git a/src/Kiota.Builder/LanguageInformation.cs b/src/Kiota.Builder/LanguageInformation.cs index c0b36309aa..d58dfa3b6a 100644 --- a/src/Kiota.Builder/LanguageInformation.cs +++ b/src/Kiota.Builder/LanguageInformation.cs @@ -15,9 +15,13 @@ public LanguageMaturityLevel MaturityLevel { get; set; } + public SupportExperience SupportExperience + { + get; set; + } #pragma warning disable CA2227 #pragma warning disable CA1002 - public List Dependencies { get; set; } = new(); + public List Dependencies { get; set; } = []; #pragma warning restore CA1002 #pragma warning restore CA2227 public string DependencyInstallCommand { get; set; } = string.Empty; @@ -32,11 +36,12 @@ public void SerializeAsV3(IOpenApiWriter writer) ArgumentNullException.ThrowIfNull(writer); writer.WriteStartObject(); writer.WriteProperty(nameof(MaturityLevel).ToFirstCharacterLowerCase(), MaturityLevel.ToString()); + writer.WriteProperty(nameof(SupportExperience).ToFirstCharacterLowerCase(), SupportExperience.ToString()); writer.WriteProperty(nameof(DependencyInstallCommand).ToFirstCharacterLowerCase(), DependencyInstallCommand); - writer.WriteOptionalCollection(nameof(Dependencies).ToFirstCharacterLowerCase(), Dependencies, (w, x) => x.SerializeAsV3(w)); + writer.WriteOptionalCollection(nameof(Dependencies).ToFirstCharacterLowerCase(), Dependencies, static (w, x) => x.SerializeAsV3(w)); writer.WriteProperty(nameof(ClientClassName).ToFirstCharacterLowerCase(), ClientClassName); writer.WriteProperty(nameof(ClientNamespaceName).ToFirstCharacterLowerCase(), ClientNamespaceName); - writer.WriteOptionalCollection(nameof(StructuredMimeTypes).ToFirstCharacterLowerCase(), StructuredMimeTypes, (w, x) => w.WriteValue(x)); + writer.WriteOptionalCollection(nameof(StructuredMimeTypes).ToFirstCharacterLowerCase(), StructuredMimeTypes, static (w, x) => w.WriteValue(x)); writer.WriteEndObject(); } public static LanguageInformation Parse(IOpenApiAny source) @@ -66,6 +71,14 @@ public static LanguageInformation Parse(IOpenApiAny source) foreach (var entry in structuredMimeTypesValue.OfType()) extension.StructuredMimeTypes.Add(entry.Value); } + if (rawObject.TryGetValue(nameof(MaturityLevel).ToFirstCharacterLowerCase(), out var maturityLevel) && maturityLevel is OpenApiString maturityLevelValue && Enum.TryParse(maturityLevelValue.Value, true, out var parsedMaturityLevelValue)) + { + extension.MaturityLevel = parsedMaturityLevelValue; + } + if (rawObject.TryGetValue(nameof(SupportExperience).ToFirstCharacterLowerCase(), out var supportExperience) && supportExperience is OpenApiString supportExperienceValue && Enum.TryParse(supportExperienceValue.Value, true, out var parsedSupportExperienceValue)) + { + extension.SupportExperience = parsedSupportExperienceValue; + } return extension; } } @@ -116,7 +129,14 @@ public enum LanguageMaturityLevel { Experimental, Preview, - Stable + Stable, + Abandoned +} + +public enum SupportExperience +{ + Microsoft, + Community } public enum DependencyType diff --git a/src/kiota/Handlers/KiotaInfoCommandHandler.cs b/src/kiota/Handlers/KiotaInfoCommandHandler.cs index 949b4f00b3..f60ab7f85e 100644 --- a/src/kiota/Handlers/KiotaInfoCommandHandler.cs +++ b/src/kiota/Handlers/KiotaInfoCommandHandler.cs @@ -113,6 +113,7 @@ private void ShowLanguagesTable() }; view.AddColumn(static x => x.Key, "Language"); view.AddColumn(static x => x.Value.MaturityLevel.ToString(), "Maturity Level"); + view.AddColumn(static x => x.Value.SupportExperience.ToString(), "Support Experience"); var console = new SystemConsole(); using var terminal = new SystemConsoleTerminal(console); var layout = new StackLayoutView { view }; @@ -125,6 +126,7 @@ private void ShowLanguageInformation(GenerationLanguage language, LanguagesInfor if (!json) { DisplayInfo($"The language {language} is currently in {languageInformation.MaturityLevel} maturity level.", + $"The support experience is provided by {languageInformation.SupportExperience}.", "After generating code for this language, you need to install the following packages:"); var orderedDependencies = languageInformation.Dependencies.OrderBy(static x => x.Name).Select(static x => x).ToList(); var filteredDependencies = (dependencyTypes.ToHashSet(), orderedDependencies.Any(static x => x.DependencyType is DependencyType.Bundle)) switch diff --git a/src/kiota/KiotaConfigurationExtensions.cs b/src/kiota/KiotaConfigurationExtensions.cs index c54572b1f6..33842b6978 100644 --- a/src/kiota/KiotaConfigurationExtensions.cs +++ b/src/kiota/KiotaConfigurationExtensions.cs @@ -37,6 +37,7 @@ public static void BindConfiguration(this KiotaConfiguration configObject, IConf ClientNamespaceName = section[nameof(LanguageInformation.ClientNamespaceName)] ?? string.Empty, DependencyInstallCommand = section[nameof(LanguageInformation.DependencyInstallCommand)] ?? string.Empty, MaturityLevel = Enum.TryParse(section[nameof(LanguageInformation.MaturityLevel)], true, out var ml) ? ml : LanguageMaturityLevel.Experimental, + SupportExperience = Enum.TryParse(section[nameof(LanguageInformation.SupportExperience)], true, out var se) ? se : SupportExperience.Community, }; section.GetSection(nameof(lngInfo.StructuredMimeTypes)).LoadHashSet(lngInfo.StructuredMimeTypes); var dependenciesSection = section.GetSection(nameof(lngInfo.Dependencies)); diff --git a/src/kiota/appsettings.json b/src/kiota/appsettings.json index 3e76f73085..a53ec54fe0 100644 --- a/src/kiota/appsettings.json +++ b/src/kiota/appsettings.json @@ -24,6 +24,7 @@ "Languages": { "CSharp": { "MaturityLevel": "Stable", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "Microsoft.Kiota.Abstractions", @@ -70,6 +71,7 @@ }, "Java": { "MaturityLevel": "Stable", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "com.microsoft.kiota:microsoft-kiota-abstractions", @@ -123,6 +125,7 @@ }, "Go": { "MaturityLevel": "Stable", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "github.com/microsoft/kiota-abstractions-go", @@ -169,6 +172,7 @@ }, "TypeScript": { "MaturityLevel": "Preview", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "@microsoft/kiota-abstractions", @@ -215,6 +219,7 @@ }, "PHP": { "MaturityLevel": "Stable", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "microsoft/kiota-abstractions", @@ -256,6 +261,7 @@ }, "Python": { "MaturityLevel": "Stable", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "microsoft-kiota-abstractions", @@ -302,6 +308,7 @@ }, "Ruby": { "MaturityLevel": "Experimental", + "SupportExperience": "Community", "Dependencies": [ { "Name": "microsoft_kiota_abstractions", @@ -328,11 +335,13 @@ }, "Swift": { "MaturityLevel": "Experimental", + "SupportExperience": "Community", "Dependencies": [], "DependencyInstallCommand": "" }, "CLI": { "MaturityLevel": "Preview", + "SupportExperience": "Microsoft", "Dependencies": [ { "Name": "Microsoft.Kiota.Abstractions", @@ -378,4 +387,4 @@ "DependencyInstallCommand": "dotnet add package {0} --version {1}" } } -} +} \ No newline at end of file diff --git a/tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiKiotaExtensionTests.cs b/tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiKiotaExtensionTests.cs index beb4c3fe4f..872f0ca6db 100644 --- a/tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiKiotaExtensionTests.cs +++ b/tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiKiotaExtensionTests.cs @@ -27,6 +27,7 @@ public void Serializes() }, DependencyInstallCommand = "dotnet add package", MaturityLevel = LanguageMaturityLevel.Preview, + SupportExperience = SupportExperience.Microsoft, ClientClassName = "GraphServiceClient", ClientNamespaceName = "Microsoft.Graph", StructuredMimeTypes = new() { @@ -43,7 +44,7 @@ public void Serializes() value.Write(writer, OpenApiSpecVersion.OpenApi3_0); var result = sWriter.ToString(); - Assert.Equal("{\"languagesInformation\":{\"CSharp\":{\"maturityLevel\":\"Preview\",\"dependencyInstallCommand\":\"dotnet add package\",\"dependencies\":[{\"name\":\"Microsoft.Graph.Core\",\"version\":\"1.0.0\",\"type\":\"Bundle\"}],\"clientClassName\":\"GraphServiceClient\",\"clientNamespaceName\":\"Microsoft.Graph\",\"structuredMimeTypes\":[\"application/json\",\"application/xml\"]}}}", result); + Assert.Equal("{\"languagesInformation\":{\"CSharp\":{\"maturityLevel\":\"Preview\",\"supportExperience\":\"Microsoft\",\"dependencyInstallCommand\":\"dotnet add package\",\"dependencies\":[{\"name\":\"Microsoft.Graph.Core\",\"version\":\"1.0.0\",\"type\":\"Bundle\"}],\"clientClassName\":\"GraphServiceClient\",\"clientNamespaceName\":\"Microsoft.Graph\",\"structuredMimeTypes\":[\"application/json\",\"application/xml\"]}}}", result); } [Fact] public void Parses() @@ -61,6 +62,7 @@ public void Parses() }}, {"dependencyInstallCommand", new OpenApiString("dotnet add package") }, {"maturityLevel", new OpenApiString("Preview")}, + {"supportExperience", new OpenApiString("Microsoft")}, {"clientClassName", new OpenApiString("GraphServiceClient")}, {"clientNamespaceName", new OpenApiString("Microsoft.Graph")}, {"structuredMimeTypes", new OpenApiArray { @@ -75,7 +77,8 @@ public void Parses() Assert.NotNull(value); Assert.True(value.LanguagesInformation.TryGetValue("CSharp", out var CSEntry)); Assert.Equal("dotnet add package", CSEntry.DependencyInstallCommand); - Assert.Equal(LanguageMaturityLevel.Experimental, CSEntry.MaturityLevel); //expected as we're not parsing the value from the description + Assert.Equal(LanguageMaturityLevel.Preview, CSEntry.MaturityLevel); + Assert.Equal(SupportExperience.Microsoft, CSEntry.SupportExperience); Assert.Equal("GraphServiceClient", CSEntry.ClientClassName); Assert.Equal("Microsoft.Graph", CSEntry.ClientNamespaceName); Assert.Single(CSEntry.Dependencies);