Skip to content

Commit

Permalink
Merge pull request #878 from christianhelle/missing-refitter-telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
christianhelle authored May 5, 2024
2 parents f1ebc3d + 86a5452 commit c321087
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.Diagnostics.CodeAnalysis;
using Rapicgen.Core.Options.Refitter;
using System.Threading.Tasks;
using Rapicgen.Core.Logging;
using Newtonsoft.Json;

namespace Rapicgen.Core.Generators.Refitter;

Expand All @@ -28,8 +30,8 @@ public RefitterCodeGenerator(
public string GenerateCode(IProgressReporter? pGenerateProgress)
{
pGenerateProgress?.Progress(10);
var generator = Task.Run(() => RefitGenerator.CreateAsync(
new RefitGeneratorSettings

var settings = new RefitGeneratorSettings
{
OpenApiPath = swaggerFile,
Namespace = defaultNamespace,
Expand All @@ -39,12 +41,16 @@ public string GenerateCode(IProgressReporter? pGenerateProgress)
ReturnIApiResponse = options.ReturnIApiResponse,
UseCancellationTokens = options.UseCancellationTokens,
GenerateOperationHeaders = options.GenerateHeaderParameters,
}))
};
var generator = Task
.Run(() => RefitGenerator.CreateAsync(settings))
.GetAwaiter()
.GetResult();

pGenerateProgress?.Progress(50);
using var context = new DependencyContext("Refitter", JsonConvert.SerializeObject(settings));
var code = generator.Generate();
context.Succeeded();

pGenerateProgress?.Progress(90);
return GeneratedCode.PrefixAutogeneratedCodeHeader(
Expand Down

0 comments on commit c321087

Please sign in to comment.