From 36323c71547d9718b75bd41db107b02e6df4f631 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 10 Jul 2026 05:05:27 +0100 Subject: [PATCH] Make CultMesh transport records serializable --- src/GameCult.Mesh/CultMeshPrimitives.cs | 32 +++++++++++++++---------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/GameCult.Mesh/CultMeshPrimitives.cs b/src/GameCult.Mesh/CultMeshPrimitives.cs index b6705f20..a7345ef2 100644 --- a/src/GameCult.Mesh/CultMeshPrimitives.cs +++ b/src/GameCult.Mesh/CultMeshPrimitives.cs @@ -57,9 +57,11 @@ namespace GameCult.Mesh /// /// Flat, transport-friendly fields for a CultMesh route hint. /// + [MessagePackObject] public sealed class CultMeshRouteRecord { /// Creates flat route fields. + [SerializationConstructor] public CultMeshRouteRecord(string? kind = null, string? description = null) { Kind = kind ?? ""; @@ -67,10 +69,10 @@ namespace GameCult.Mesh } /// Gets the serialized route locality kind. - public string Kind { get; } + [Key(0)] public string Kind { get; } /// Gets the serialized route description. - public string Description { get; } + [Key(1)] public string Description { get; } /// Creates flat route fields from a route hint. public static CultMeshRouteRecord FromRoute(CultMeshRouteHint? routeHint) @@ -3171,9 +3173,11 @@ namespace GameCult.Mesh /// /// Transport-friendly fields for a typed state binding descriptor. /// + [MessagePackObject] public sealed class CultMeshStateBindingRecord { /// Creates a state binding record. + [SerializationConstructor] public CultMeshStateBindingRecord( string? targetProp = null, string? pointerId = null, @@ -3191,22 +3195,22 @@ namespace GameCult.Mesh } /// Gets the component property receiving the resolved state value. - public string TargetProp { get; } + [Key(0)] public string TargetProp { get; } /// Gets the semantic CultMesh state pointer id. - public string PointerId { get; } + [Key(1)] public string PointerId { get; } /// Gets the source document, cache, native view, or daemon source id. - public string SourceId { get; } + [Key(2)] public string SourceId { get; } /// Gets the source schema id. - public string SchemaId { get; } + [Key(3)] public string SchemaId { get; } /// Gets the flattened route kind. - public string RouteKind { get; } + [Key(4)] public string RouteKind { get; } /// Gets the flattened route description. - public string RouteDescription { get; } + [Key(5)] public string RouteDescription { get; } /// Creates transport-friendly fields from a state binding descriptor. public static CultMeshStateBindingRecord FromBinding(CultMeshStateBindingDescriptor? binding) @@ -3300,9 +3304,11 @@ namespace GameCult.Mesh /// /// Transport-friendly fields for a typed operation binding descriptor. /// + [MessagePackObject] public sealed class CultMeshOperationBindingRecord { /// Creates an operation binding record. + [SerializationConstructor] public CultMeshOperationBindingRecord( string? operationId = null, string? label = null, @@ -3318,19 +3324,19 @@ namespace GameCult.Mesh } /// Gets the semantic CultMesh operation id. - public string OperationId { get; } + [Key(0)] public string OperationId { get; } /// Gets the human-facing command label. - public string Label { get; } + [Key(1)] public string Label { get; } /// Gets the optional request schema id for the operation. - public string SchemaId { get; } + [Key(2)] public string SchemaId { get; } /// Gets the flattened route kind. - public string RouteKind { get; } + [Key(3)] public string RouteKind { get; } /// Gets the flattened route description. - public string RouteDescription { get; } + [Key(4)] public string RouteDescription { get; } /// Creates transport-friendly fields from an operation binding descriptor. public static CultMeshOperationBindingRecord FromBinding(CultMeshOperationBindingDescriptor? binding)