Skip to content

Commit 6168d61

Browse files
committed
change default output path for kiota with endpoint mapping
1 parent 305921b commit 6168d61

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

Src/ClientGen.Kiota/ClientGenConfig.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ public sealed class ClientGenConfig : GenerationConfiguration
1111
public string SwaggerDocumentName { get; set; } = null!;
1212

1313
/// <summary>
14-
/// specify whether to zip up the generated client files
14+
/// specify whether to zip up the generated client files.
15+
/// <para>
16+
/// NOTE: this property has no effect when client generation endpoints are mapped as the creation of a zip archive is mandatory
17+
/// in order to provide a downloadable byte stream.
18+
/// </para>
1519
/// </summary>
1620
public bool CreateZipArchive { get; set; }
1721

Src/ClientGen.Kiota/Extensions.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@ public static IEndpointRouteBuilder MapApiClientEndpoint(this IEndpointRouteBuil
2929
route,
3030
async (IHost app, HttpContext httpCtx, CancellationToken ct) =>
3131
{
32-
var c = new ClientGenConfig { OutputPath = "ClientGen" };
32+
var c = new ClientGenConfig { OutputPath = Path.Combine(Path.GetTempPath(), "KiotaClientGen") };
3333
config(c);
3434
c.CreateZipArchive = true;
3535

3636
await GenerateClient(app, c, ct);
3737

38-
Directory.Delete(c.OutputPath, true);
39-
4038
var zipFile = Path.GetFullPath(c.ZipOutputFile!);
4139
await Results.File(
4240
path: zipFile,

Src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
33

4-
<Version>5.21.2.17-beta</Version>
4+
<Version>5.21.2.18-beta</Version>
55

66
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
77
<LangVersion>latest</LangVersion>

Src/Library/changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ Now the Swagger path parameter is correctly rendered to match with the exact val
9494

9595
</details>
9696

97+
<details><summary>Change default output location for Kiota Api Client generation</summary>
98+
99+
When using `.MapApiClientEndpoint()`, previously the default value was a sub folder called `ClientGen` under the current folder. The default has been changed to a sub folder called `KiotaClientGen` in the current user's `TEMP` folder away from any project/source files, which is a much safer default location.
100+
101+
</details>
102+
97103
## Fixes 🪲
98104

99105
<details><summary>Type discovery source generator creating duplicates for partial classes</summary>

0 commit comments

Comments
 (0)