Skip to content

Commit 0a1d70f

Browse files
committed
fix: missing messageId serialization
1 parent 1870fb2 commit 0a1d70f

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/ByteBard.AsyncAPI/Models/AsyncApiMessage.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public virtual void SerializeV2(IAsyncApiWriter writer)
9999
}
100100

101101
writer.WriteStartObject();
102+
writer.WriteOptionalProperty(AsyncApiConstants.MessageId, this.MessageId);
102103
writer.WriteOptionalObject(AsyncApiConstants.Headers, this.Headers, (w, h) => h.SerializeV2(w));
103104
writer.WriteOptionalObject(AsyncApiConstants.Payload, this.Payload, (w, p) => p.SerializeV2(w));
104105
writer.WriteOptionalObject(AsyncApiConstants.CorrelationId, this.CorrelationId, (w, c) => c.SerializeV2(w));
@@ -119,4 +120,4 @@ public virtual void SerializeV2(IAsyncApiWriter writer)
119120
writer.WriteEndObject();
120121
}
121122
}
122-
}
123+
}

test/ByteBard.AsyncAPI.Tests/Models/AsyncApiMessage_Should.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ public void AsyncApiMessage_WithFilledObject_Serializes()
243243
{
244244
var expected =
245245
"""
246+
messageId: myMessage
246247
headers:
247248
title: HeaderTitle
248249
description: HeaderDescription
@@ -313,6 +314,7 @@ public void AsyncApiMessage_WithFilledObject_Serializes()
313314

314315
var message = new AsyncApiMessage
315316
{
317+
MessageId = "myMessage",
316318
Headers = new AsyncApiJsonSchema
317319
{
318320
Title = "HeaderTitle",

0 commit comments

Comments
 (0)