Skip to content

Commit 66109db

Browse files
committed
Spec for introducing null reports and source registration time
configuration
1 parent 0460954 commit 66109db

File tree

3 files changed

+205
-22
lines changed

3 files changed

+205
-22
lines changed

header-validator/data.trigger.js

+18
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const testCases = [
1212
"filters": {"x": []},
1313
"not_filters": {"y": []}
1414
}],
15+
"aggregatable_source_registration_time": "include",
1516
"aggregatable_trigger_data": [{
1617
"filters": {"a": ["b"]},
1718
"key_piece": "0x1",
@@ -527,4 +528,21 @@ export const testCases = [
527528
msg: "must match 'aws-cloud' (case-sensitive)",
528529
}],
529530
},
531+
532+
{
533+
name: "aggregatable-source-registrationt-time-wrong-type",
534+
json: `{"aggregatable_source_registration_time": 1}`,
535+
expectedErrors: [{
536+
path: ["aggregatable_source_registration_time"],
537+
msg: "must be a string",
538+
}],
539+
},
540+
{
541+
name: "aggregatable-source-registration-time-unknown-value",
542+
json: `{"aggregatable_source_registration_time": "OMIT"}`,
543+
expectedErrors: [{
544+
path: ["aggregatable_source_registration_time"],
545+
msg: "must match 'omit' or 'include' (case-sensitive)",
546+
}],
547+
},
530548
];

header-validator/validate-json.js

+10
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,15 @@ const aggregatableDedupKeys = list(
301301
not_filters: optional(filters()),
302302
}))
303303

304+
const aggregatableSourceRegistrationTime = string((state, value) => {
305+
const omit = 'omit'
306+
const include = 'include'
307+
if (value === omit || value === include) {
308+
return
309+
}
310+
state.error(`must match '${omit}' or '${include}' (case-sensitive)`)
311+
})
312+
304313
export function validateTrigger(trigger) {
305314
const state = new State()
306315
state.validate(trigger, {
@@ -313,6 +322,7 @@ export function validateTrigger(trigger) {
313322
filters: optional(orFilters),
314323
not_filters: optional(orFilters),
315324
aggregatable_deduplication_keys: optional(aggregatableDedupKeys),
325+
aggregatable_source_registration_time : optional(aggregatableSourceRegistrationTime),
316326
})
317327
return state.result()
318328
}

0 commit comments

Comments
 (0)