Skip to content

Commit

Permalink
Fixed: return empty object instead of data:null in operation results
Browse files Browse the repository at this point in the history
  • Loading branch information
bkoelman committed Jun 19, 2024
1 parent a7389ed commit 649cce7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,28 @@ public override void Write(Utf8JsonWriter writer, Document value, JsonSerializer
if (!value.Results.IsNullOrEmpty())
{
writer.WritePropertyName(AtomicResultsText);
WriteSubTree(writer, value.Results, options);
writer.WriteStartArray();

foreach (AtomicResultObject result in value.Results)
{
writer.WriteStartObject();

if (result.Data.IsAssigned)
{
writer.WritePropertyName(DataText);
WriteSubTree(writer, result.Data, options);
}

if (!result.Meta.IsNullOrEmpty())
{
writer.WritePropertyName(MetaText);
WriteSubTree(writer, result.Meta, options);
}

writer.WriteEndObject();
}

writer.WriteEndArray();
}

if (!value.Errors.IsNullOrEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
"self": "http://localhost/operations"
},
"atomic:results": [
{
"data": null
},
{},
{
"data": {
"type": "textLanguages",
Expand Down

0 comments on commit 649cce7

Please sign in to comment.