Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/experimental warning #4358

Merged
merged 3 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;

namespace kiota.Authentication.GitHub.DeviceCode;

Expand Down
5 changes: 2 additions & 3 deletions src/kiota/Extension/ILoggerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;

namespace kiota;

Expand All @@ -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(
@" ▒▒░░▒▒ ░░ ▒▒░░▒▒
@" ▒▒░░▒▒ ░░ ▒▒░░▒▒
▒▒ ██████ ▒▒
██████ ██▒▒██ ██████
██▒▒██ ██▒▒██ ██▒▒██
Expand Down
14 changes: 6 additions & 8 deletions src/kiota/Handlers/BaseKiotaCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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.");
Expand Down
9 changes: 2 additions & 7 deletions src/kiota/Handlers/Client/AddHandler.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -95,6 +89,7 @@ public override async Task<int> 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)
Expand Down
8 changes: 1 addition & 7 deletions src/kiota/Handlers/Client/EditHandler.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
7 changes: 1 addition & 6 deletions src/kiota/Handlers/Client/GenerateHandler.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Handlers/Client/RemoveHandler.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
8 changes: 1 addition & 7 deletions src/kiota/Handlers/KiotaDownloadCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
8 changes: 2 additions & 6 deletions src/kiota/Handlers/KiotaGenerateCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -94,6 +89,7 @@ public override async Task<int> 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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Handlers/KiotaGitHubLogoutCommandhandler.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Handlers/KiotaGitHubPatLoginCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
8 changes: 1 addition & 7 deletions src/kiota/Handlers/KiotaInfoCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 1 addition & 5 deletions src/kiota/Handlers/KiotaRpcCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Handlers/KiotaSeachBasedCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
7 changes: 1 addition & 6 deletions src/kiota/Handlers/KiotaSearchCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
7 changes: 1 addition & 6 deletions src/kiota/Handlers/KiotaShowCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 1 addition & 5 deletions src/kiota/Handlers/KiotaUpdateCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 1 addition & 5 deletions src/kiota/Handlers/Workspace/InitHandler.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
7 changes: 1 addition & 6 deletions src/kiota/Handlers/Workspace/MigrateHandler.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
5 changes: 1 addition & 4 deletions src/kiota/KiotaConfigurationExtensions.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
5 changes: 1 addition & 4 deletions src/kiota/KiotaHost.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.CommandLine;
using System.Linq;
using System.Threading.Tasks;
using System.CommandLine;

namespace kiota;
static class Program
Expand Down
4 changes: 1 addition & 3 deletions src/kiota/Rpc/ForwardedLogger.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;

namespace kiota.Rpc;
public class ForwardedLogger<T> : ILogger<T>
Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Rpc/IServer.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/kiota/Rpc/ManifestResult.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
using System.Collections.Generic;

namespace kiota.Rpc;
namespace kiota.Rpc;
public record ManifestResult(List<LogEntry> logs, string? apiDescriptionPath, string[]? selectedPaths);
4 changes: 1 addition & 3 deletions src/kiota/Rpc/NoopLogger.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

using System;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;

namespace kiota.Rpc;
public class NoopLogger<T> : ILogger<T>
Expand Down
3 changes: 1 addition & 2 deletions src/kiota/Rpc/SearchResult.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Kiota.Builder.SearchProviders;
using Kiota.Builder.SearchProviders;

namespace kiota.Rpc;

Expand Down
9 changes: 1 addition & 8 deletions src/kiota/Rpc/Server.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
5 changes: 1 addition & 4 deletions src/kiota/Rpc/ShowResult.cs
Original file line number Diff line number Diff line change
@@ -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);

Expand Down
Loading
Loading