diff --git a/CHANGELOG.md b/CHANGELOG.md index a8523e155e..08dd3c5055 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixes a bug where models would be duplicated in some allOf scenarios [#4191](https://github.com/microsoft/kiota/issues/4191) - Fixes a bug where CLI Generation does not handle path parameters of type "string" and format "date", "date-time", "time", etc. [#4615](https://github.com/microsoft/kiota/issues/4615) - Fixes a bug where request executors would be missing Untyped parameters in dotnet [#4692](https://github.com/microsoft/kiota/issues/4692) +- Fixes a bug where CLI generation doesnot handle parameters of type string array. [#4707](https://github.com/microsoft/kiota/issues/4707) ## [1.14.0] - 2024-05-02 diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs index 0275f5bd50..9310c3c5c0 100644 --- a/src/Kiota.Builder/KiotaBuilder.cs +++ b/src/Kiota.Builder/KiotaBuilder.cs @@ -2402,14 +2402,18 @@ private static CodeType GetDefaultQueryParameterType() Name = "string", }; } - private static CodeType GetQueryParameterType(OpenApiSchema schema) => - GetPrimitiveType(schema) ?? new() + private static CodeType GetQueryParameterType(OpenApiSchema schema) + { + var paramType = GetPrimitiveType(schema) ?? new() { IsExternal = true, Name = schema.Items?.Type ?? schema.Type, - CollectionKind = schema.IsArray() ? CodeTypeBase.CodeTypeCollectionKind.Array : default, }; + paramType.CollectionKind = schema.IsArray() ? CodeTypeBase.CodeTypeCollectionKind.Array : default; + return paramType; + } + private void CleanUpInternalState() { foreach (var lifecycle in classLifecycles.Values) diff --git a/src/Kiota.Builder/Refiners/CSharpRefiner.cs b/src/Kiota.Builder/Refiners/CSharpRefiner.cs index f618db0898..5e36de1890 100644 --- a/src/Kiota.Builder/Refiners/CSharpRefiner.cs +++ b/src/Kiota.Builder/Refiners/CSharpRefiner.cs @@ -221,6 +221,10 @@ protected static void CorrectMethodType(CodeMethod currentMethod) .Select(x => x.Type) .Union(new[] { currentMethod.ReturnType }) .ToArray()); + CorrectCoreTypes(currentMethod.Parent as CodeClass, DateTypesReplacements, currentMethod.PathQueryAndHeaderParameters + .Select(x => x.Type) + .Union(new[] { currentMethod.ReturnType }) + .ToArray()); } private static readonly Dictionary DateTypesReplacements = new(StringComparer.OrdinalIgnoreCase)