Skip to content

Commit

Permalink
- fixes missing serializers/deserializers on client update/edit
Browse files Browse the repository at this point in the history
  • Loading branch information
baywet committed Mar 6, 2024
1 parent cd2fd86 commit 7c97dc9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/kiota/Handlers/BaseKiotaCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ namespace kiota.Handlers;

internal abstract class BaseKiotaCommandHandler : ICommandHandler, IDisposable
{
protected void DefaultSerializersAndDeserializers(GenerationConfiguration generationConfiguration)
{ // needed until we have rollup packages
var defaultGenerationConfiguration = new GenerationConfiguration();
generationConfiguration.Serializers = defaultGenerationConfiguration.Serializers;
generationConfiguration.Deserializers = defaultGenerationConfiguration.Deserializers;
}
protected TempFolderCachingAccessTokenProvider GetGitHubDeviceStorageService(ILogger logger) => new()
{
Logger = logger,
Expand Down
1 change: 1 addition & 0 deletions src/kiota/Handlers/Client/EditHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public override async Task<int> InvokeAsync(InvocationContext context)
Configuration.Generation.StructuredMimeTypes = new(structuredMimeTypes.SelectMany(static x => x.Split(' ', StringSplitOptions.RemoveEmptyEntries))
.Select(static x => x.TrimQuotes()));

DefaultSerializersAndDeserializers(Configuration.Generation);
var builder = new KiotaBuilder(logger, Configuration.Generation, httpClient, true);
var result = await builder.GenerateClientAsync(cancellationToken).ConfigureAwait(false);
if (result)
Expand Down
1 change: 1 addition & 0 deletions src/kiota/Handlers/Client/GenerateHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public override async Task<int> InvokeAsync(InvocationContext context)
var generationConfiguration = new GenerationConfiguration();
var requests = !refresh && manifest is not null && manifest.ApiDependencies.TryGetValue(clientEntry.Key, out var value) ? value.Requests : [];
clientEntry.Value.UpdateGenerationConfigurationFromApiClientConfiguration(generationConfiguration, clientEntry.Key, requests);
DefaultSerializersAndDeserializers(generationConfiguration);
generationConfiguration.ClearCache = refresh;
generationConfiguration.CleanOutput = refresh;
generationConfiguration.Operation = ClientOperation.Generate;
Expand Down

0 comments on commit 7c97dc9

Please sign in to comment.