Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit 0c9d589

Browse files
committed
Add ExtensionData to Report record so that it is picked up by Scriban
1 parent e007b3d commit 0c9d589

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed

src/ApiService/ApiService/OneFuzzTypes/Model.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,10 @@ public record Report(
509509
string? ToolName,
510510
string? ToolVersion,
511511
string? OnefuzzVersion,
512-
Uri? ReportUrl
512+
Uri? ReportUrl,
513+
[property: JsonExtensionData]
514+
Dictionary<string, JsonElement>? ExtensionData
513515
) : IReport, ITruncatable<Report> {
514-
515-
[JsonExtensionData] public Dictionary<string, JsonElement>? ExtensionData { get; set; }
516516
public Report Truncate(int maxLength) {
517517
return this with {
518518
Executable = TruncateUtils.TruncateString(Executable, maxLength),

src/ApiService/ApiService/onefuzzlib/notifications/JinjaTemplateAdapter.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.Extensions.Logging;
1+
using System.Text.Json;
2+
using Microsoft.Extensions.Logging;
23
namespace Microsoft.OneFuzz.Service;
34

45
public class JinjaTemplateAdapter {
@@ -116,7 +117,8 @@ public static async Async.Task<TemplateValidationResponse> ValidateScribanTempla
116117
toolName,
117118
toolVersion,
118119
onefuzzVersion,
119-
reportUrl
120+
reportUrl,
121+
new Dictionary<string, JsonElement>()
120122
);
121123

122124
var preReqTasks = new List<Guid> { Guid.NewGuid(), Guid.NewGuid() };

src/ApiService/IntegrationTests/ReproVmssTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ public async Async.Task CannotCreateVMForMissingReport() {
165165
null,
166166
null,
167167
null,
168+
null,
168169
null
169170
);
170171

src/ApiService/Tests/OrmModelsTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ from i in Arb.Generate<int>()
204204
ToolName: s,
205205
ToolVersion: s,
206206
OnefuzzVersion: s,
207-
ReportUrl: u));
207+
ReportUrl: u,
208+
ExtensionData: null));
208209

209210
public static Arbitrary<Container> ArbContainer()
210211
=> Arb.From(from len in Gen.Choose(3, 63)

src/ApiService/Tests/TemplateTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ private static Report GetReport() {
214214
null,
215215
null,
216216
null,
217-
null
217+
null,
218+
new Dictionary<string, JsonElement>()
218219
);
219220
}
220221

src/ApiService/Tests/TruncationTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Text.Json;
34
using FluentAssertions;
45
using Microsoft.OneFuzz.Service;
56
using Xunit;
@@ -75,7 +76,8 @@ public static Report GenerateReport() {
7576
null,
7677
null,
7778
null,
78-
new Uri("http://example.com")
79+
new Uri("http://example.com"),
80+
new Dictionary<string, JsonElement>()
7981
);
8082
}
8183

0 commit comments

Comments
 (0)