Skip to content

Commit 86afe48

Browse files
committed
fix: add instance path trailing slash
Signed-off-by: Rifa Achrinza <[email protected]>
1 parent 583761c commit 86afe48

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

scripts/advisories/validate-csaf20.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ function validateTracking(fileContents: any): ValidationResult {
7777

7878
if (tracking.status !== 'final') {
7979
errors.push({
80-
instancePath: 'document/tracking/status',
80+
instancePath: '/document/tracking/status',
8181
message: 'status must equal `final`.',
8282
});
8383
}
8484

8585
if (tracking.revision_history[0].date != tracking.current_release_date) {
8686
errors.push({
87-
instancePath: 'document/tracking/current_release_date',
87+
instancePath: '/document/tracking/current_release_date',
8888
message: 'current_release_date does not match latest revision history.',
8989
});
9090
}
@@ -94,7 +94,7 @@ function validateTracking(fileContents: any): ValidationResult {
9494
tracking.initial_release_date
9595
) {
9696
errors.push({
97-
instancePath: 'document/tracking/initial_release_date',
97+
instancePath: '/document/tracking/initial_release_date',
9898
message: 'initial_release_date does not match first revision history.',
9999
});
100100
}
@@ -115,7 +115,7 @@ function validateTracking(fileContents: any): ValidationResult {
115115
versioningSystem
116116
) {
117117
errors.push({
118-
instancePath: `document/revision_history/${i}/number`,
118+
instancePath: `/document/revision_history/${i}/number`,
119119
message: 'number version system inconsistent.',
120120
});
121121
}
@@ -138,14 +138,14 @@ function validateDistribution(fileContents: any): ValidationResult {
138138

139139
if ((distribution.text as string) !== standardisedDistributionInfo) {
140140
errors.push({
141-
instancePath: 'document/distribution/text',
141+
instancePath: '/document/distribution/text',
142142
message: `text must be \`${standardisedDistributionInfo}\``,
143143
});
144144
}
145145

146146
if (distribution.tlp?.label !== 'WHITE') {
147147
errors.push({
148-
instancePath: 'document/distribution/tlp/label',
148+
instancePath: '/document/distribution/tlp/label',
149149
message: 'label must be `WHITE`',
150150
});
151151
}
@@ -167,14 +167,14 @@ function validateProductTree(fileContents: any): ValidationResult {
167167
const lbRootBranch = productTree[lbRootBranchIndex];
168168
if (lbRootBranch.category !== 'vendor') {
169169
errors.push({
170-
instancePath: `product_tree/branches/${lbRootBranchIndex}/category`,
170+
instancePath: `/product_tree/branches/${lbRootBranchIndex}/category`,
171171
message:
172172
'category must be `vendor` for `The LoopBack Maintainers` vendor root branch.',
173173
});
174174
}
175175
} else {
176176
errors.push({
177-
instancePath: 'product_tree/branches',
177+
instancePath: '/product_tree/branches',
178178
message: '`The LoopBack Maintainers` vendor root branch must exist.',
179179
});
180180
}
@@ -191,21 +191,21 @@ function validatePublisher(fileContents: any): ValidationResult {
191191

192192
if (publisher.category !== 'vendor') {
193193
errors.push({
194-
instancePath: 'document/publisher/category',
194+
instancePath: '/document/publisher/category',
195195
message: 'category must equal `vendor`',
196196
});
197197
}
198198

199199
if (publisher.name !== 'The LoopBack Maintainers') {
200200
errors.push({
201-
instancePath: 'document/publisher/name',
201+
instancePath: '/document/publisher/name',
202202
message: 'name must equal `The LoopBack Maintainers`',
203203
});
204204
}
205205

206206
if (publisher.namespace !== 'https://loopback.io') {
207207
errors.push({
208-
instancePath: 'document/publisher/namespace',
208+
instancePath: '/document/publisher/namespace',
209209
message: 'namespace must equal `https://loopback.io`',
210210
});
211211
}

0 commit comments

Comments
 (0)