Skip to content

Commit

Permalink
- adds warning for preview languages
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Biret <[email protected]>
  • Loading branch information
baywet committed Mar 19, 2024
1 parent d651fad commit d7a0b55
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
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
5 changes: 5 additions & 0 deletions src/kiota/Handlers/BaseKiotaCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,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
1 change: 1 addition & 0 deletions src/kiota/Handlers/Client/AddHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,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
1 change: 1 addition & 0 deletions src/kiota/Handlers/KiotaGenerateCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,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

0 comments on commit d7a0b55

Please sign in to comment.