Skip to content

Commit 5e9151b

Browse files
committed
fix(relationship.schema): restore transform to flag deprecation warning
1 parent 49c296e commit 5e9151b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/schemas/sro/relationship.schema.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,20 @@ export const relationshipSchema = attackBaseRelationshipObjectSchema
302302
.strict()
303303
.check((ctx) => {
304304
createRelationshipValidationRefinement()(ctx);
305+
})
306+
.transform((data) => {
307+
// Check for deprecated pattern
308+
const [sourceType] = data.source_ref.split('--') as [StixType];
309+
if (
310+
sourceType === 'x-mitre-data-component' &&
311+
data.relationship_type === 'detects' &&
312+
data.target_ref.startsWith('attack-pattern--')
313+
) {
314+
console.warn(
315+
'DEPRECATION WARNING: x-mitre-data-component -> detects -> attack-pattern relationships are deprecated',
316+
);
317+
}
318+
return data;
305319
});
306320

307321
export type Relationship = z.infer<typeof relationshipSchema>;

0 commit comments

Comments
 (0)