Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refs #4707 bug fix to handle string array querry parameters. #4708

Merged
merged 3 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading