Skip to content

Commit dd7a554

Browse files
💾 Feat(Blueprint): 添加多态 JSON 序列化支持,以确保具体节点类型通过 System.Text.Json 正确回传
1 parent 0740abe commit dd7a554

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

KitX Core Contracts/KitX.Core.Contract/Workflow/BlueprintModels.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,22 @@ public class BlueprintPin
184184
}
185185

186186
/// <summary>
187-
/// Base class for all blueprint nodes
187+
/// Base class for all blueprint nodes.
188+
/// Uses polymorphic JSON serialization so that concrete node types
189+
/// round-trip correctly through System.Text.Json.
188190
/// </summary>
191+
[JsonPolymorphic(UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)]
192+
[JsonDerivedType(typeof(EntryNode), "Entry")]
193+
[JsonDerivedType(typeof(BranchNode), "Branch")]
194+
[JsonDerivedType(typeof(LoopNode), "Loop")]
195+
[JsonDerivedType(typeof(BreakNode), "Break")]
196+
[JsonDerivedType(typeof(ConstNode), "Const")]
197+
[JsonDerivedType(typeof(CallNode), "Call")]
198+
[JsonDerivedType(typeof(CallHelperNode), "CallHelper")]
199+
[JsonDerivedType(typeof(GetNode), "Get")]
200+
[JsonDerivedType(typeof(SetNode), "Set")]
201+
[JsonDerivedType(typeof(PrintNode), "Print")]
202+
[JsonDerivedType(typeof(PauseNode), "Pause")]
189203
public abstract class BlueprintNode
190204
{
191205
/// <summary>

0 commit comments

Comments
 (0)