Skip to content

Commit

Permalink
Merge pull request #4708 from rohitkrsoni/feature/4707/rohitkrosni
Browse files Browse the repository at this point in the history
refs #4707 bug fix to handle string array querry parameters.
  • Loading branch information
andrueastman authored May 24, 2024
2 parents 213cd4b + 81dbea8 commit 0e195ec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 7 additions & 3 deletions src/Kiota.Builder/KiotaBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions src/Kiota.Builder/Refiners/CSharpRefiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, (string, CodeUsing?)> DateTypesReplacements = new(StringComparer.OrdinalIgnoreCase)
Expand Down

0 comments on commit 0e195ec

Please sign in to comment.