Fix missing (de)serializer registration after workspace refresh - #7996
Draft
Gavin Barron (gavinbarron) with Copilot wants to merge 2 commits into
Draft
Fix missing (de)serializer registration after workspace refresh#7996Gavin Barron (gavinbarron) with Copilot wants to merge 2 commits into
Gavin Barron (gavinbarron) with Copilot wants to merge 2 commits into
Conversation
…kspace config Removes the Serializers.Clear() and Deserializers.Clear() calls from UpdateGenerationConfigurationFromBase that were incorrectly clearing the default serializer/deserializer collections. These defaults are needed by ReplaceDefaultSerializationModules/ReplaceDefaultDeserializationModules in language refiners to replace C# defaults with language-specific ones. When using `kiota client generate --refresh`, a fresh GenerationConfiguration is created with C# defaults, then UpdateGenerationConfigurationFromBase was called which cleared those defaults. The TypeScript refiner checks if the modules match the default count before replacing them - since they were empty (count 0), no replacement happened and the generated client had empty if-blocks for (de)serializer registration. Fixes #7584
Copilot
AI
changed the title
[WIP] Fix TypeScript clients serialization issue during refresh
Fix missing (de)serializer registration after workspace refresh
Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When running
kiota client generate --refresh, the generated TypeScript client had emptyifblocks for serializer/deserializer registration, causing compile errors.Root cause
BaseApiConsumerConfiguration.UpdateGenerationConfigurationFromBasewas clearing the default serializer/deserializer collections:Language refiners replace the C# defaults with language-specific ones only when the collection matches the defaults in count and content:
After clearing (count = 0), the condition
0 == 4always fails — no replacement happens, and the generated client emits empty registration blocks.Fix
BaseApiConsumerConfiguration.cs— Remove the twoClear()calls. A freshGenerationConfigurationis always constructed before callingUpdateGenerationConfigurationFromApiClientConfiguration, so the C# defaults are always present and available for language refiners to replace.ApiClientConfigurationTests.cs— Update the assertion to verify defaults are preserved (NotEmpty) rather than cleared.