Skip to content

Commit 05bb1b1

Browse files
authored
Merge pull request #5818 from microsoft/feat/support-experience
feat: adds support experience to language information
2 parents e6258cf + 648450d commit 05bb1b1

File tree

6 files changed

+46
-10
lines changed

6 files changed

+46
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Added
1313

14+
- Added a notion of support experience for languages in preparation for new community implemented languages.
15+
1416
### Changed
1517

1618
- Fixed python generation in scenarios with opening/closing tags for code comments. [#5636](https://github.com/microsoft/kiota/issues/5636)
@@ -155,7 +157,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
155157
- Added uri-form encoded serialization for PHP. [#2074](https://github.com/microsoft/kiota/issues/2074)
156158
- Added information message with base URL in the CLI experience. [#4635](https://github.com/microsoft/kiota/issues/4635)
157159
- Added optional parameter --disable-ssl-validation for generate, show, and download commands. [#4176](https://github.com/microsoft/kiota/issues/4176)
158-
- 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)
160+
- 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)
159161

160162
### Changed
161163

@@ -757,7 +759,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
757759
- Removed unused generated import for PHP Generation.
758760
- Fixed a bug where long namespaces would make Ruby packaging fail.
759761
- Fixed a bug where classes with namespace names are generated outside namespace in Python. [#2188](https://github.com/microsoft/kiota/issues/2188)
760-
- Changed signature of escaped reserved names from {x}_escaped to {x}_ in line with Python style guides.
762+
- Changed signature of escaped reserved names from {x}*escaped to {x}* in line with Python style guides.
761763
- Add null checks in generated Shell language code.
762764
- Fixed a bug where Go indexers would fail to pass the index parameter.
763765
- Fixed a bug where path segments with parameters could be missing words. [#2209](https://github.com/microsoft/kiota/issues/2209)
@@ -1506,4 +1508,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
15061508
### Added
15071509

15081510
- Initial GitHub release
1509-

src/Kiota.Builder/LanguageInformation.cs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ public LanguageMaturityLevel MaturityLevel
1515
{
1616
get; set;
1717
}
18+
public SupportExperience SupportExperience
19+
{
20+
get; set;
21+
}
1822
#pragma warning disable CA2227
1923
#pragma warning disable CA1002
20-
public List<LanguageDependency> Dependencies { get; set; } = new();
24+
public List<LanguageDependency> Dependencies { get; set; } = [];
2125
#pragma warning restore CA1002
2226
#pragma warning restore CA2227
2327
public string DependencyInstallCommand { get; set; } = string.Empty;
@@ -32,11 +36,12 @@ public void SerializeAsV3(IOpenApiWriter writer)
3236
ArgumentNullException.ThrowIfNull(writer);
3337
writer.WriteStartObject();
3438
writer.WriteProperty(nameof(MaturityLevel).ToFirstCharacterLowerCase(), MaturityLevel.ToString());
39+
writer.WriteProperty(nameof(SupportExperience).ToFirstCharacterLowerCase(), SupportExperience.ToString());
3540
writer.WriteProperty(nameof(DependencyInstallCommand).ToFirstCharacterLowerCase(), DependencyInstallCommand);
36-
writer.WriteOptionalCollection(nameof(Dependencies).ToFirstCharacterLowerCase(), Dependencies, (w, x) => x.SerializeAsV3(w));
41+
writer.WriteOptionalCollection(nameof(Dependencies).ToFirstCharacterLowerCase(), Dependencies, static (w, x) => x.SerializeAsV3(w));
3742
writer.WriteProperty(nameof(ClientClassName).ToFirstCharacterLowerCase(), ClientClassName);
3843
writer.WriteProperty(nameof(ClientNamespaceName).ToFirstCharacterLowerCase(), ClientNamespaceName);
39-
writer.WriteOptionalCollection(nameof(StructuredMimeTypes).ToFirstCharacterLowerCase(), StructuredMimeTypes, (w, x) => w.WriteValue(x));
44+
writer.WriteOptionalCollection(nameof(StructuredMimeTypes).ToFirstCharacterLowerCase(), StructuredMimeTypes, static (w, x) => w.WriteValue(x));
4045
writer.WriteEndObject();
4146
}
4247
public static LanguageInformation Parse(IOpenApiAny source)
@@ -66,6 +71,14 @@ public static LanguageInformation Parse(IOpenApiAny source)
6671
foreach (var entry in structuredMimeTypesValue.OfType<OpenApiString>())
6772
extension.StructuredMimeTypes.Add(entry.Value);
6873
}
74+
if (rawObject.TryGetValue(nameof(MaturityLevel).ToFirstCharacterLowerCase(), out var maturityLevel) && maturityLevel is OpenApiString maturityLevelValue && Enum.TryParse<LanguageMaturityLevel>(maturityLevelValue.Value, true, out var parsedMaturityLevelValue))
75+
{
76+
extension.MaturityLevel = parsedMaturityLevelValue;
77+
}
78+
if (rawObject.TryGetValue(nameof(SupportExperience).ToFirstCharacterLowerCase(), out var supportExperience) && supportExperience is OpenApiString supportExperienceValue && Enum.TryParse<SupportExperience>(supportExperienceValue.Value, true, out var parsedSupportExperienceValue))
79+
{
80+
extension.SupportExperience = parsedSupportExperienceValue;
81+
}
6982
return extension;
7083
}
7184
}
@@ -116,7 +129,14 @@ public enum LanguageMaturityLevel
116129
{
117130
Experimental,
118131
Preview,
119-
Stable
132+
Stable,
133+
Abandoned
134+
}
135+
136+
public enum SupportExperience
137+
{
138+
Microsoft,
139+
Community
120140
}
121141

122142
public enum DependencyType

src/kiota/Handlers/KiotaInfoCommandHandler.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ private void ShowLanguagesTable()
113113
};
114114
view.AddColumn(static x => x.Key, "Language");
115115
view.AddColumn(static x => x.Value.MaturityLevel.ToString(), "Maturity Level");
116+
view.AddColumn(static x => x.Value.SupportExperience.ToString(), "Support Experience");
116117
var console = new SystemConsole();
117118
using var terminal = new SystemConsoleTerminal(console);
118119
var layout = new StackLayoutView { view };
@@ -125,6 +126,7 @@ private void ShowLanguageInformation(GenerationLanguage language, LanguagesInfor
125126
if (!json)
126127
{
127128
DisplayInfo($"The language {language} is currently in {languageInformation.MaturityLevel} maturity level.",
129+
$"The support experience is provided by {languageInformation.SupportExperience}.",
128130
"After generating code for this language, you need to install the following packages:");
129131
var orderedDependencies = languageInformation.Dependencies.OrderBy(static x => x.Name).Select(static x => x).ToList();
130132
var filteredDependencies = (dependencyTypes.ToHashSet(), orderedDependencies.Any(static x => x.DependencyType is DependencyType.Bundle)) switch

src/kiota/KiotaConfigurationExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public static void BindConfiguration(this KiotaConfiguration configObject, IConf
3737
ClientNamespaceName = section[nameof(LanguageInformation.ClientNamespaceName)] ?? string.Empty,
3838
DependencyInstallCommand = section[nameof(LanguageInformation.DependencyInstallCommand)] ?? string.Empty,
3939
MaturityLevel = Enum.TryParse<LanguageMaturityLevel>(section[nameof(LanguageInformation.MaturityLevel)], true, out var ml) ? ml : LanguageMaturityLevel.Experimental,
40+
SupportExperience = Enum.TryParse<SupportExperience>(section[nameof(LanguageInformation.SupportExperience)], true, out var se) ? se : SupportExperience.Community,
4041
};
4142
section.GetSection(nameof(lngInfo.StructuredMimeTypes)).LoadHashSet(lngInfo.StructuredMimeTypes);
4243
var dependenciesSection = section.GetSection(nameof(lngInfo.Dependencies));

src/kiota/appsettings.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"Languages": {
2525
"CSharp": {
2626
"MaturityLevel": "Stable",
27+
"SupportExperience": "Microsoft",
2728
"Dependencies": [
2829
{
2930
"Name": "Microsoft.Kiota.Abstractions",
@@ -70,6 +71,7 @@
7071
},
7172
"Java": {
7273
"MaturityLevel": "Stable",
74+
"SupportExperience": "Microsoft",
7375
"Dependencies": [
7476
{
7577
"Name": "com.microsoft.kiota:microsoft-kiota-abstractions",
@@ -123,6 +125,7 @@
123125
},
124126
"Go": {
125127
"MaturityLevel": "Stable",
128+
"SupportExperience": "Microsoft",
126129
"Dependencies": [
127130
{
128131
"Name": "github.com/microsoft/kiota-abstractions-go",
@@ -169,6 +172,7 @@
169172
},
170173
"TypeScript": {
171174
"MaturityLevel": "Preview",
175+
"SupportExperience": "Microsoft",
172176
"Dependencies": [
173177
{
174178
"Name": "@microsoft/kiota-abstractions",
@@ -215,6 +219,7 @@
215219
},
216220
"PHP": {
217221
"MaturityLevel": "Stable",
222+
"SupportExperience": "Microsoft",
218223
"Dependencies": [
219224
{
220225
"Name": "microsoft/kiota-abstractions",
@@ -256,6 +261,7 @@
256261
},
257262
"Python": {
258263
"MaturityLevel": "Stable",
264+
"SupportExperience": "Microsoft",
259265
"Dependencies": [
260266
{
261267
"Name": "microsoft-kiota-abstractions",
@@ -302,6 +308,7 @@
302308
},
303309
"Ruby": {
304310
"MaturityLevel": "Experimental",
311+
"SupportExperience": "Community",
305312
"Dependencies": [
306313
{
307314
"Name": "microsoft_kiota_abstractions",
@@ -328,11 +335,13 @@
328335
},
329336
"Swift": {
330337
"MaturityLevel": "Experimental",
338+
"SupportExperience": "Community",
331339
"Dependencies": [],
332340
"DependencyInstallCommand": ""
333341
},
334342
"CLI": {
335343
"MaturityLevel": "Preview",
344+
"SupportExperience": "Microsoft",
336345
"Dependencies": [
337346
{
338347
"Name": "Microsoft.Kiota.Abstractions",
@@ -378,4 +387,4 @@
378387
"DependencyInstallCommand": "dotnet add package {0} --version {1}"
379388
}
380389
}
381-
}
390+
}

tests/Kiota.Builder.Tests/OpenApiExtensions/OpenApiKiotaExtensionTests.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public void Serializes()
2727
},
2828
DependencyInstallCommand = "dotnet add package",
2929
MaturityLevel = LanguageMaturityLevel.Preview,
30+
SupportExperience = SupportExperience.Microsoft,
3031
ClientClassName = "GraphServiceClient",
3132
ClientNamespaceName = "Microsoft.Graph",
3233
StructuredMimeTypes = new() {
@@ -43,7 +44,7 @@ public void Serializes()
4344

4445
value.Write(writer, OpenApiSpecVersion.OpenApi3_0);
4546
var result = sWriter.ToString();
46-
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);
47+
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);
4748
}
4849
[Fact]
4950
public void Parses()
@@ -61,6 +62,7 @@ public void Parses()
6162
}},
6263
{"dependencyInstallCommand", new OpenApiString("dotnet add package") },
6364
{"maturityLevel", new OpenApiString("Preview")},
65+
{"supportExperience", new OpenApiString("Microsoft")},
6466
{"clientClassName", new OpenApiString("GraphServiceClient")},
6567
{"clientNamespaceName", new OpenApiString("Microsoft.Graph")},
6668
{"structuredMimeTypes", new OpenApiArray {
@@ -75,7 +77,8 @@ public void Parses()
7577
Assert.NotNull(value);
7678
Assert.True(value.LanguagesInformation.TryGetValue("CSharp", out var CSEntry));
7779
Assert.Equal("dotnet add package", CSEntry.DependencyInstallCommand);
78-
Assert.Equal(LanguageMaturityLevel.Experimental, CSEntry.MaturityLevel); //expected as we're not parsing the value from the description
80+
Assert.Equal(LanguageMaturityLevel.Preview, CSEntry.MaturityLevel);
81+
Assert.Equal(SupportExperience.Microsoft, CSEntry.SupportExperience);
7982
Assert.Equal("GraphServiceClient", CSEntry.ClientClassName);
8083
Assert.Equal("Microsoft.Graph", CSEntry.ClientNamespaceName);
8184
Assert.Single(CSEntry.Dependencies);

0 commit comments

Comments
 (0)