diff --git a/CHANGELOG.md b/CHANGELOG.md index 2224a66040..204b88679d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added a warning message in the CLI when using preview languages. [#4316](https://github.com/microsoft/kiota/issues/4316) + ### Changed - PREVIEW: Renamed the config commands to workspace. [#4310](https://github.com/microsoft/kiota/issues/4310) diff --git a/src/kiota/Authentication/GitHub/DeviceCode/AccessTokenProvider.cs b/src/kiota/Authentication/GitHub/DeviceCode/AccessTokenProvider.cs index 9712d899df..4ef6de464d 100644 --- a/src/kiota/Authentication/GitHub/DeviceCode/AccessTokenProvider.cs +++ b/src/kiota/Authentication/GitHub/DeviceCode/AccessTokenProvider.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Net.Http; -using System.Net.Http.Headers; +using System.Net.Http.Headers; using System.Net.Http.Json; using System.Text.Json.Serialization; -using System.Threading; -using System.Threading.Tasks; using Kiota.Builder.SearchProviders.GitHub.Authentication; using Microsoft.Kiota.Abstractions.Authentication; diff --git a/src/kiota/Authentication/GitHub/DeviceCode/DeviceCodeAuthenticationProvider.cs b/src/kiota/Authentication/GitHub/DeviceCode/DeviceCodeAuthenticationProvider.cs index 0ebe9c809d..6816dd6f9d 100644 --- a/src/kiota/Authentication/GitHub/DeviceCode/DeviceCodeAuthenticationProvider.cs +++ b/src/kiota/Authentication/GitHub/DeviceCode/DeviceCodeAuthenticationProvider.cs @@ -1,8 +1,4 @@ - -using System; -using System.Collections.Generic; -using System.Net.Http; -using Kiota.Builder.SearchProviders.GitHub.Authentication; +using Kiota.Builder.SearchProviders.GitHub.Authentication; using Microsoft.Extensions.Logging; using Microsoft.Kiota.Abstractions.Authentication; diff --git a/src/kiota/Authentication/GitHub/DeviceCode/DeviceCodeResponse.cs b/src/kiota/Authentication/GitHub/DeviceCode/DeviceCodeResponse.cs index 0ee57357ea..74b397ef78 100644 --- a/src/kiota/Authentication/GitHub/DeviceCode/DeviceCodeResponse.cs +++ b/src/kiota/Authentication/GitHub/DeviceCode/DeviceCodeResponse.cs @@ -1,5 +1,4 @@ -using System; -using System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace kiota.Authentication.GitHub.DeviceCode; diff --git a/src/kiota/Extension/ILoggerExtensions.cs b/src/kiota/Extension/ILoggerExtensions.cs index 3d5fe00079..b92ea92f4b 100644 --- a/src/kiota/Extension/ILoggerExtensions.cs +++ b/src/kiota/Extension/ILoggerExtensions.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; namespace kiota; @@ -18,7 +17,7 @@ public static void AppendInternalTracing(this ILogger logger) var currentDateTime = DateTime.UtcNow; if (currentDateTime.Month != 3 || currentDateTime.Day != 9 || currentDateTime.Year < 2024) return; logger.LogWarning( -@" ▒▒░░▒▒ ░░ ▒▒░░▒▒ + @" ▒▒░░▒▒ ░░ ▒▒░░▒▒ ▒▒ ██████ ▒▒ ██████ ██▒▒██ ██████ ██▒▒██ ██▒▒██ ██▒▒██ diff --git a/src/kiota/Handlers/BaseKiotaCommandHandler.cs b/src/kiota/Handlers/BaseKiotaCommandHandler.cs index 5908458894..11db4586b1 100644 --- a/src/kiota/Handlers/BaseKiotaCommandHandler.cs +++ b/src/kiota/Handlers/BaseKiotaCommandHandler.cs @@ -1,12 +1,5 @@ -using System; -using System.Collections.Generic; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; -using System.IO; -using System.Linq; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; using kiota.Authentication.GitHub.DeviceCode; using Kiota.Builder; using Kiota.Builder.Configuration; @@ -349,6 +342,11 @@ protected void WarnShouldUseKiotaConfigClientsCommands() if (KiotaHost.IsConfigPreviewEnabled.Value) DisplayWarning("Warning: the kiota generate and update commands are deprecated, use kiota client commands instead."); } + protected void WarnUsingPreviewLanguage(GenerationLanguage language) + { + if (Configuration.Languages.TryGetValue(language.ToString(), out var languageInformation) && languageInformation.MaturityLevel is not LanguageMaturityLevel.Stable) + DisplayWarning($"Warning: the {language} language is in preview ({languageInformation.MaturityLevel}) some features are not fully supported and source breaking changes will happen with future updates."); + } protected void DisplayGitHubDeviceCodeLoginMessage(Uri uri, string code) { DisplayInfo($"Please go to {uri} and enter the code {code} to authenticate."); diff --git a/src/kiota/Handlers/Client/AddHandler.cs b/src/kiota/Handlers/Client/AddHandler.cs index 86b1d706da..9808f3835a 100644 --- a/src/kiota/Handlers/Client/AddHandler.cs +++ b/src/kiota/Handlers/Client/AddHandler.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; -using System.IO; -using System.Linq; using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; using Kiota.Builder; using Kiota.Builder.Configuration; using Kiota.Builder.Extensions; @@ -95,6 +89,7 @@ public override async Task InvokeAsync(InvocationContext context) Configuration.Generation.ExcludeBackwardCompatible = excludeBackwardCompatible; Configuration.Generation.IncludeAdditionalData = includeAdditionalData; Configuration.Generation.Language = language; + WarnUsingPreviewLanguage(language); Configuration.Generation.SkipGeneration = skipGeneration; Configuration.Generation.Operation = ClientOperation.Add; if (includePatterns.Count != 0) diff --git a/src/kiota/Handlers/Client/EditHandler.cs b/src/kiota/Handlers/Client/EditHandler.cs index 9a0a764a64..09bd603f2e 100644 --- a/src/kiota/Handlers/Client/EditHandler.cs +++ b/src/kiota/Handlers/Client/EditHandler.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; -using System.IO; -using System.Linq; using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; using Kiota.Builder; using Kiota.Builder.Configuration; using Kiota.Builder.Extensions; diff --git a/src/kiota/Handlers/Client/GenerateHandler.cs b/src/kiota/Handlers/Client/GenerateHandler.cs index 51c011125b..d4787f744c 100644 --- a/src/kiota/Handlers/Client/GenerateHandler.cs +++ b/src/kiota/Handlers/Client/GenerateHandler.cs @@ -1,11 +1,6 @@ -using System; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; -using System.IO; -using System.Linq; using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; using Kiota.Builder; using Kiota.Builder.Configuration; using Kiota.Builder.WorkspaceManagement; diff --git a/src/kiota/Handlers/Client/RemoveHandler.cs b/src/kiota/Handlers/Client/RemoveHandler.cs index a4e6a190b4..38237fc11d 100644 --- a/src/kiota/Handlers/Client/RemoveHandler.cs +++ b/src/kiota/Handlers/Client/RemoveHandler.cs @@ -1,8 +1,5 @@ -using System; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; -using System.Threading; -using System.Threading.Tasks; using Kiota.Builder; using Kiota.Builder.WorkspaceManagement; using Microsoft.Extensions.Logging; diff --git a/src/kiota/Handlers/KiotaDownloadCommandHandler.cs b/src/kiota/Handlers/KiotaDownloadCommandHandler.cs index 771ad67cef..e5d8334be3 100644 --- a/src/kiota/Handlers/KiotaDownloadCommandHandler.cs +++ b/src/kiota/Handlers/KiotaDownloadCommandHandler.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; -using System.IO; -using System.Linq; using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; using Kiota.Builder; using Kiota.Builder.Caching; using Kiota.Builder.Configuration; diff --git a/src/kiota/Handlers/KiotaGenerateCommandHandler.cs b/src/kiota/Handlers/KiotaGenerateCommandHandler.cs index d552a0ccb4..c199f043ec 100644 --- a/src/kiota/Handlers/KiotaGenerateCommandHandler.cs +++ b/src/kiota/Handlers/KiotaGenerateCommandHandler.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; -using System.Linq; using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; using Kiota.Builder; using Kiota.Builder.Extensions; @@ -94,6 +89,7 @@ public override async Task InvokeAsync(InvocationContext context) Configuration.Generation.ExcludeBackwardCompatible = excludeBackwardCompatible; Configuration.Generation.IncludeAdditionalData = includeAdditionalData; Configuration.Generation.Language = language; + WarnUsingPreviewLanguage(language); if (serializer.Count != 0) Configuration.Generation.Serializers = serializer.Select(static x => x.TrimQuotes()).ToHashSet(StringComparer.OrdinalIgnoreCase); if (deserializer.Count != 0) diff --git a/src/kiota/Handlers/KiotaGitHubDeviceLoginCommandHanlder.cs b/src/kiota/Handlers/KiotaGitHubDeviceLoginCommandHanlder.cs index 1b162aa4ab..3eea8ab850 100644 --- a/src/kiota/Handlers/KiotaGitHubDeviceLoginCommandHanlder.cs +++ b/src/kiota/Handlers/KiotaGitHubDeviceLoginCommandHanlder.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.CommandLine.Invocation; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; +using System.CommandLine.Invocation; using kiota.Authentication.GitHub.DeviceCode; using Kiota.Builder.SearchProviders.GitHub.GitHubClient; using Microsoft.Extensions.Logging; diff --git a/src/kiota/Handlers/KiotaGitHubLogoutCommandhandler.cs b/src/kiota/Handlers/KiotaGitHubLogoutCommandhandler.cs index 73241773dc..1688e3b4fd 100644 --- a/src/kiota/Handlers/KiotaGitHubLogoutCommandhandler.cs +++ b/src/kiota/Handlers/KiotaGitHubLogoutCommandhandler.cs @@ -1,7 +1,4 @@ -using System; -using System.CommandLine.Invocation; -using System.Threading; -using System.Threading.Tasks; +using System.CommandLine.Invocation; using Kiota.Builder.SearchProviders.GitHub.Authentication; using Microsoft.Extensions.Logging; diff --git a/src/kiota/Handlers/KiotaGitHubPatLoginCommandHandler.cs b/src/kiota/Handlers/KiotaGitHubPatLoginCommandHandler.cs index 517e43b03d..cc01a44030 100644 --- a/src/kiota/Handlers/KiotaGitHubPatLoginCommandHandler.cs +++ b/src/kiota/Handlers/KiotaGitHubPatLoginCommandHandler.cs @@ -1,8 +1,5 @@ -using System; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; -using System.Threading; -using System.Threading.Tasks; using Kiota.Builder.SearchProviders.GitHub.Authentication; using Microsoft.Extensions.Logging; diff --git a/src/kiota/Handlers/KiotaInfoCommandHandler.cs b/src/kiota/Handlers/KiotaInfoCommandHandler.cs index 53909064cd..cd0272bee6 100644 --- a/src/kiota/Handlers/KiotaInfoCommandHandler.cs +++ b/src/kiota/Handlers/KiotaInfoCommandHandler.cs @@ -1,14 +1,8 @@ -using System; -using System.Collections.Generic; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; using System.CommandLine.IO; using System.CommandLine.Rendering; using System.CommandLine.Rendering.Views; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Kiota.Builder; using Kiota.Builder.Configuration; using Microsoft.Extensions.Logging; diff --git a/src/kiota/Handlers/KiotaRpcCommandHandler.cs b/src/kiota/Handlers/KiotaRpcCommandHandler.cs index 80bf5ce9c2..849b2da57a 100644 --- a/src/kiota/Handlers/KiotaRpcCommandHandler.cs +++ b/src/kiota/Handlers/KiotaRpcCommandHandler.cs @@ -1,10 +1,6 @@ -using System; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; -using System.IO; using System.IO.Pipes; -using System.Threading; -using System.Threading.Tasks; using kiota.Rpc; using Nerdbank.Streams; using StreamJsonRpc; diff --git a/src/kiota/Handlers/KiotaSeachBasedCommandHandler.cs b/src/kiota/Handlers/KiotaSeachBasedCommandHandler.cs index ef80c15cee..f3e7721247 100644 --- a/src/kiota/Handlers/KiotaSeachBasedCommandHandler.cs +++ b/src/kiota/Handlers/KiotaSeachBasedCommandHandler.cs @@ -1,7 +1,4 @@ -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; namespace kiota.Handlers; diff --git a/src/kiota/Handlers/KiotaSearchCommandHandler.cs b/src/kiota/Handlers/KiotaSearchCommandHandler.cs index b1fd621d9b..b559ec257e 100644 --- a/src/kiota/Handlers/KiotaSearchCommandHandler.cs +++ b/src/kiota/Handlers/KiotaSearchCommandHandler.cs @@ -1,14 +1,9 @@ -using System; -using System.Collections.Generic; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; using System.CommandLine.IO; using System.CommandLine.Rendering; using System.CommandLine.Rendering.Views; -using System.Linq; using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; using Kiota.Builder; using Kiota.Builder.SearchProviders; using Microsoft.Extensions.Logging; diff --git a/src/kiota/Handlers/KiotaShowCommandHandler.cs b/src/kiota/Handlers/KiotaShowCommandHandler.cs index b621a9b26f..eba912371e 100644 --- a/src/kiota/Handlers/KiotaShowCommandHandler.cs +++ b/src/kiota/Handlers/KiotaShowCommandHandler.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; -using System.Linq; using System.Text; -using System.Threading; -using System.Threading.Tasks; using Kiota.Builder; using Kiota.Builder.Extensions; using Microsoft.Extensions.Logging; diff --git a/src/kiota/Handlers/KiotaUpdateCommandHandler.cs b/src/kiota/Handlers/KiotaUpdateCommandHandler.cs index 391d2d1f47..5d71c8c9d9 100644 --- a/src/kiota/Handlers/KiotaUpdateCommandHandler.cs +++ b/src/kiota/Handlers/KiotaUpdateCommandHandler.cs @@ -1,9 +1,5 @@ -using System; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Kiota.Builder; using Kiota.Builder.Configuration; using Kiota.Builder.Lock; diff --git a/src/kiota/Handlers/Workspace/InitHandler.cs b/src/kiota/Handlers/Workspace/InitHandler.cs index 90fbbc9116..8dfcac9767 100644 --- a/src/kiota/Handlers/Workspace/InitHandler.cs +++ b/src/kiota/Handlers/Workspace/InitHandler.cs @@ -1,8 +1,4 @@ -using System; -using System.CommandLine.Invocation; -using System.IO; -using System.Threading; -using System.Threading.Tasks; +using System.CommandLine.Invocation; using Kiota.Builder.WorkspaceManagement; using Microsoft.Extensions.Logging; diff --git a/src/kiota/Handlers/Workspace/MigrateHandler.cs b/src/kiota/Handlers/Workspace/MigrateHandler.cs index abd7f956f3..066149929a 100644 --- a/src/kiota/Handlers/Workspace/MigrateHandler.cs +++ b/src/kiota/Handlers/Workspace/MigrateHandler.cs @@ -1,10 +1,5 @@ -using System; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Kiota.Builder.WorkspaceManagement; using Microsoft.Extensions.Logging; diff --git a/src/kiota/KiotaConfigurationExtensions.cs b/src/kiota/KiotaConfigurationExtensions.cs index e2a0a3edb5..d9704e485f 100644 --- a/src/kiota/KiotaConfigurationExtensions.cs +++ b/src/kiota/KiotaConfigurationExtensions.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Kiota.Builder; +using Kiota.Builder; using Kiota.Builder.Configuration; using Microsoft.Extensions.Configuration; diff --git a/src/kiota/KiotaHost.cs b/src/kiota/KiotaHost.cs index 91317c3bba..4323e97fcf 100644 --- a/src/kiota/KiotaHost.cs +++ b/src/kiota/KiotaHost.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Parsing; -using System.Linq; using System.Text.RegularExpressions; using kiota.Handlers; using kiota.Rpc; diff --git a/src/kiota/Program.cs b/src/kiota/Program.cs index f3e3a9486e..1509b077a3 100644 --- a/src/kiota/Program.cs +++ b/src/kiota/Program.cs @@ -1,7 +1,4 @@ -using System; -using System.CommandLine; -using System.Linq; -using System.Threading.Tasks; +using System.CommandLine; namespace kiota; static class Program diff --git a/src/kiota/Rpc/ForwardedLogger.cs b/src/kiota/Rpc/ForwardedLogger.cs index f024909b94..e3af5c698e 100644 --- a/src/kiota/Rpc/ForwardedLogger.cs +++ b/src/kiota/Rpc/ForwardedLogger.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; namespace kiota.Rpc; public class ForwardedLogger : ILogger diff --git a/src/kiota/Rpc/IServer.cs b/src/kiota/Rpc/IServer.cs index 5f5ca21920..52f1409e41 100644 --- a/src/kiota/Rpc/IServer.cs +++ b/src/kiota/Rpc/IServer.cs @@ -1,7 +1,4 @@ -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Kiota.Builder; +using Kiota.Builder; using Kiota.Builder.Configuration; namespace kiota.Rpc; diff --git a/src/kiota/Rpc/ManifestResult.cs b/src/kiota/Rpc/ManifestResult.cs index 6181931e84..4e432211ee 100644 --- a/src/kiota/Rpc/ManifestResult.cs +++ b/src/kiota/Rpc/ManifestResult.cs @@ -1,4 +1,2 @@ -using System.Collections.Generic; - -namespace kiota.Rpc; +namespace kiota.Rpc; public record ManifestResult(List logs, string? apiDescriptionPath, string[]? selectedPaths); diff --git a/src/kiota/Rpc/NoopLogger.cs b/src/kiota/Rpc/NoopLogger.cs index af21af84ac..edfe3ec2c4 100644 --- a/src/kiota/Rpc/NoopLogger.cs +++ b/src/kiota/Rpc/NoopLogger.cs @@ -1,6 +1,4 @@ - -using System; -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; namespace kiota.Rpc; public class NoopLogger : ILogger diff --git a/src/kiota/Rpc/SearchResult.cs b/src/kiota/Rpc/SearchResult.cs index 6b38a9b2d6..0e75c927f2 100644 --- a/src/kiota/Rpc/SearchResult.cs +++ b/src/kiota/Rpc/SearchResult.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using Kiota.Builder.SearchProviders; +using Kiota.Builder.SearchProviders; namespace kiota.Rpc; diff --git a/src/kiota/Rpc/Server.cs b/src/kiota/Rpc/Server.cs index 3972129f0b..878aa9b9d0 100644 --- a/src/kiota/Rpc/Server.cs +++ b/src/kiota/Rpc/Server.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net.Http; -using System.Text.RegularExpressions; -using System.Threading; -using System.Threading.Tasks; +using System.Text.RegularExpressions; using Kiota.Builder; using Kiota.Builder.Configuration; using Kiota.Builder.Extensions; diff --git a/src/kiota/Rpc/ShowResult.cs b/src/kiota/Rpc/ShowResult.cs index d1dae34972..9cd69af3f7 100644 --- a/src/kiota/Rpc/ShowResult.cs +++ b/src/kiota/Rpc/ShowResult.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; - -namespace kiota.Rpc; +namespace kiota.Rpc; public record PathItem(string path, string segment, PathItem[] children, bool selected, bool isOperation = false, Uri? documentationUrl = null); diff --git a/src/kiota/kiota.csproj b/src/kiota/kiota.csproj index 818bcbe718..025a76fa17 100644 --- a/src/kiota/kiota.csproj +++ b/src/kiota/kiota.csproj @@ -29,6 +29,7 @@ ..\Microsoft.OpenApi.snk enable true + enable @@ -40,7 +41,8 @@ - + @@ -50,7 +52,8 @@ - + @@ -60,4 +63,4 @@ PreserveNewest - + \ No newline at end of file