Skip to content

Commit

Permalink
change default output path for kiota with endpoint mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
dj-nitehawk committed Jan 27, 2024
1 parent 305921b commit 6168d61
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
6 changes: 5 additions & 1 deletion Src/ClientGen.Kiota/ClientGenConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ public sealed class ClientGenConfig : GenerationConfiguration
public string SwaggerDocumentName { get; set; } = null!;

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

Expand Down
4 changes: 1 addition & 3 deletions Src/ClientGen.Kiota/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ public static IEndpointRouteBuilder MapApiClientEndpoint(this IEndpointRouteBuil
route,
async (IHost app, HttpContext httpCtx, CancellationToken ct) =>
{
var c = new ClientGenConfig { OutputPath = "ClientGen" };
var c = new ClientGenConfig { OutputPath = Path.Combine(Path.GetTempPath(), "KiotaClientGen") };
config(c);
c.CreateZipArchive = true;

await GenerateClient(app, c, ct);

Directory.Delete(c.OutputPath, true);

var zipFile = Path.GetFullPath(c.ZipOutputFile!);
await Results.File(
path: zipFile,
Expand Down
2 changes: 1 addition & 1 deletion Src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>

<Version>5.21.2.17-beta</Version>
<Version>5.21.2.18-beta</Version>

<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
Expand Down
6 changes: 6 additions & 0 deletions Src/Library/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ Now the Swagger path parameter is correctly rendered to match with the exact val

</details>

<details><summary>Change default output location for Kiota Api Client generation</summary>

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.

</details>

## Fixes 🪲

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

0 comments on commit 6168d61

Please sign in to comment.