Skip to content

Commit

Permalink
feat: adds support experience to language information
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Biret <[email protected]>
  • Loading branch information
baywet committed Nov 22, 2024
1 parent ca0f832 commit 41444c3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 8 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1505,4 +1507,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Initial GitHub release

28 changes: 24 additions & 4 deletions src/Kiota.Builder/LanguageInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ public LanguageMaturityLevel MaturityLevel
{
get; set;
}
public SupportExperience SupportExperience
{
get; set;
}
#pragma warning disable CA2227
#pragma warning disable CA1002
public List<LanguageDependency> Dependencies { get; set; } = new();
public List<LanguageDependency> Dependencies { get; set; } = [];
#pragma warning restore CA1002
#pragma warning restore CA2227
public string DependencyInstallCommand { get; set; } = string.Empty;
Expand All @@ -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)
Expand Down Expand Up @@ -66,6 +71,14 @@ public static LanguageInformation Parse(IOpenApiAny source)
foreach (var entry in structuredMimeTypesValue.OfType<OpenApiString>())
extension.StructuredMimeTypes.Add(entry.Value);
}
if (rawObject.TryGetValue(nameof(MaturityLevel).ToFirstCharacterLowerCase(), out var maturityLevel) && maturityLevel is OpenApiString maturityLevelValue && Enum.TryParse<LanguageMaturityLevel>(maturityLevelValue.Value, true, out var parsedMaturityLevelValue))
{
extension.MaturityLevel = parsedMaturityLevelValue;
}
if (rawObject.TryGetValue(nameof(SupportExperience).ToFirstCharacterLowerCase(), out var supportExperience) && supportExperience is OpenApiString supportExperienceValue && Enum.TryParse<SupportExperience>(supportExperienceValue.Value, true, out var parsedSupportExperienceValue))
{
extension.SupportExperience = parsedSupportExperienceValue;
}
return extension;
}
}
Expand Down Expand Up @@ -116,7 +129,14 @@ public enum LanguageMaturityLevel
{
Experimental,
Preview,
Stable
Stable,
Abandoned
}

public enum SupportExperience
{
Microsoft,
Community
}

public enum DependencyType
Expand Down
2 changes: 2 additions & 0 deletions src/kiota/Handlers/KiotaInfoCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/kiota/KiotaConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<LanguageMaturityLevel>(section[nameof(LanguageInformation.MaturityLevel)], true, out var ml) ? ml : LanguageMaturityLevel.Experimental,
SupportExperience = Enum.TryParse<SupportExperience>(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));
Expand Down
11 changes: 10 additions & 1 deletion src/kiota/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"Languages": {
"CSharp": {
"MaturityLevel": "Stable",
"SupportExperience": "Microsoft",
"Dependencies": [
{
"Name": "Microsoft.Kiota.Abstractions",
Expand Down Expand Up @@ -70,6 +71,7 @@
},
"Java": {
"MaturityLevel": "Stable",
"SupportExperience": "Microsoft",
"Dependencies": [
{
"Name": "com.microsoft.kiota:microsoft-kiota-abstractions",
Expand Down Expand Up @@ -123,6 +125,7 @@
},
"Go": {
"MaturityLevel": "Stable",
"SupportExperience": "Microsoft",
"Dependencies": [
{
"Name": "github.com/microsoft/kiota-abstractions-go",
Expand Down Expand Up @@ -169,6 +172,7 @@
},
"TypeScript": {
"MaturityLevel": "Preview",
"SupportExperience": "Microsoft",
"Dependencies": [
{
"Name": "@microsoft/kiota-abstractions",
Expand Down Expand Up @@ -215,6 +219,7 @@
},
"PHP": {
"MaturityLevel": "Stable",
"SupportExperience": "Microsoft",
"Dependencies": [
{
"Name": "microsoft/kiota-abstractions",
Expand Down Expand Up @@ -256,6 +261,7 @@
},
"Python": {
"MaturityLevel": "Stable",
"SupportExperience": "Microsoft",
"Dependencies": [
{
"Name": "microsoft-kiota-abstractions",
Expand Down Expand Up @@ -302,6 +308,7 @@
},
"Ruby": {
"MaturityLevel": "Experimental",
"SupportExperience": "Community",
"Dependencies": [
{
"Name": "microsoft_kiota_abstractions",
Expand All @@ -328,11 +335,13 @@
},
"Swift": {
"MaturityLevel": "Experimental",
"SupportExperience": "Community",
"Dependencies": [],
"DependencyInstallCommand": ""
},
"CLI": {
"MaturityLevel": "Preview",
"SupportExperience": "Microsoft",
"Dependencies": [
{
"Name": "Microsoft.Kiota.Abstractions",
Expand Down Expand Up @@ -378,4 +387,4 @@
"DependencyInstallCommand": "dotnet add package {0} --version {1}"
}
}
}
}

0 comments on commit 41444c3

Please sign in to comment.