Skip to content

Commit

Permalink
Merge branch 'main' into feature/typescript/composed-types
Browse files Browse the repository at this point in the history
  • Loading branch information
koros committed May 23, 2024
2 parents d61a5be + f109c3b commit 9a9d267
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixes a bug where paths without operationIds would not be included in the generated plugins and ensured operationIds are cleaned up [#4642](https://github.com/microsoft/kiota/issues/4642)
- 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)

## [1.14.0] - 2024-05-02

Expand Down
2 changes: 1 addition & 1 deletion it/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<kiota-java.version>1.1.11</kiota-java.version>
<kiota-java.version>1.1.12</kiota-java.version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion it/python/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ httpx[http2]==0.27.0

hyperframe==6.0.1 ; python_full_version >= '3.6.1'

microsoft-kiota-abstractions==1.3.2
microsoft-kiota-abstractions==1.3.3

microsoft-kiota-authentication-azure==1.0.0

Expand Down
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Writers/CSharp/CodeMethodWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ protected void WriteRequestExecutorBody(CodeMethod codeElement, RequestParams re
writer.CloseBlock("};");
}
var returnTypeCodeType = codeElement.ReturnType as CodeType;
var returnTypeFactory = returnTypeCodeType?.TypeDefinition is CodeClass
var returnTypeFactory = returnTypeCodeType?.TypeDefinition is CodeClass || (returnTypeCodeType != null && returnTypeCodeType.Name.Equals(KiotaBuilder.UntypedNodeName, StringComparison.OrdinalIgnoreCase))
? $", {returnTypeWithoutCollectionInformation}.CreateFromDiscriminatorValue"
: null;
var prefix = (isVoid, codeElement.ReturnType.IsCollection) switch
Expand Down
26 changes: 26 additions & 0 deletions tests/Kiota.Builder.Tests/Writers/CSharp/CodeMethodWriterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,32 @@ public void WritesRequestExecutorBody()
AssertExtensions.CurlyBracesAreClosed(result, 1);
}
[Fact]
public void WritesRequestExecutorBodyWithUntypedReturnValue()
{
setup();
method.Kind = CodeMethodKind.RequestExecutor;
method.HttpMethod = HttpMethod.Get;
method.ReturnType = new CodeType { TypeDefinition = null, Name = KiotaBuilder.UntypedNodeName };
var errorXXX = root.AddClass(new CodeClass
{
Name = "ErrorXXX",
}).First();
method.AddErrorMapping("XXX", new CodeType { Name = "ErrorXXX", TypeDefinition = errorXXX });
AddRequestBodyParameters();
writer.Write(method);
var result = tw.ToString();
Assert.Contains("var requestInfo", result);
Assert.Contains("var errorMapping = new Dictionary<string, ParsableFactory<IParsable>>", result);
Assert.Contains("<exception cref=", result);
Assert.Contains("{ \"XXX\", ErrorXXX.CreateFromDiscriminatorValue },", result);
Assert.Contains("SendAsync", result);
Assert.Contains("UntypedNode.CreateFromDiscriminatorValue", result);
Assert.Contains(AsyncKeyword, result);
Assert.Contains("await", result);
Assert.Contains("cancellationToken", result);
AssertExtensions.CurlyBracesAreClosed(result, 1);
}
[Fact]
public void WritesRequestGeneratorBodyForMultipart()
{
setup();
Expand Down

0 comments on commit 9a9d267

Please sign in to comment.