tomasfabian / ksqlDB.RestApi.Client-DotNet

ksqlDb.RestApi.Client is a C# LINQ-enabled client API for issuing and consuming ksqlDB push and pull queries and executing statements.
MIT License
94 stars 25 forks source link

RowValueJsonSerializer.Deserialize<byte[]> fails #35

Closed woutersmit closed 1 year ago

woutersmit commented 1 year ago

Describe the bug Deserialization of rawJson to byte[] fails since v2.5.1 (commit a0da7784baa4f12f58768db8f3a17280540016ba)

To Reproduce

  [TestMethod]
  public void Deserialize_RecordAsByteArray()
  {
    //Arrange
    var queryStreamHeader = new QueryStreamHeader()
    {
      ColumnTypes = new[] { "MESSAGE" },
      ColumnNames = new[] { "BYTES" },
    };

    ClassUnderTest = new RowValueJsonSerializer(queryStreamHeader);

    string rawJson = "[\"e30=\"]";
    var jsonSerializationOptions = KSqlDbJsonSerializerOptions.CreateInstance();

    //Act
    var rowValue = ClassUnderTest.Deserialize<byte[]>(rawJson, jsonSerializationOptions);

    //Assert
    rowValue.Value.Should().BeOfType<byte[]>();
    rowValue.Value[0].Should().Be(0x7b);
    rowValue.Value[1].Should().Be(0x7d);
  }

Expected behavior Serialization of byte[] conform unittest above

Screenshots

Environment (please complete the following information):

tomasfabian commented 1 year ago

Hi @woutersmit, could you please review this PR please?

Thank you (also for the provided unit test)!

woutersmit commented 1 year ago

Placed one comment. Rest LFTM.

On Wed, Dec 7, 2022 at 8:50 PM Tomas Fabian @.***> wrote:

Hi @woutersmit https://github.com/woutersmit, could you please review this PR https://github.com/tomasfabian/ksqlDB.RestApi.Client-DotNet/pull/36 please?

Thank you!

— Reply to this email directly, view it on GitHub https://github.com/tomasfabian/ksqlDB.RestApi.Client-DotNet/issues/35#issuecomment-1341507647, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABEQ7G36SKRRGUTOREYYGLWMDTBZANCNFSM6AAAAAASW66F34 . You are receiving this because you were mentioned.Message ID: @.***>