Skip to content

Commit c5cbe1c

Browse files
live1206Copilot
andauthored
Restore MRW traversal comments
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d7d33aa commit c5cbe1c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ModelReaderWriterContextDefinition.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ protected override IReadOnlyList<MethodBodyStatement> BuildAttributes()
9696
// Process each output-library provider recursively to discover types from methods and properties.
9797
foreach (var provider in contextEligibleOutputProviders)
9898
{
99+
// Only output-library providers get standalone context entries.
99100
if (ImplementsModelReaderWriter(provider))
100101
{
101102
buildableProviders.Add(provider);
@@ -184,6 +185,8 @@ private void CollectBuildableTypesRecursiveCore(
184185

185186
if (provider is ModelProvider modelProvider && modelProvider.BaseModelProvider != null)
186187
{
188+
// Traverse base model properties for discoverable types, but do not add the base model
189+
// itself as a context entry unless it was in the output-library seed set.
187190
CollectBuildableTypeProvidersRecursive(modelProvider.BaseModelProvider, visitedTypes, visitedTypeProviders, buildableProviders, buildableTypes);
188191
}
189192
else

0 commit comments

Comments
 (0)