From 9e07429e7bce32cf3ed99543b11f1254b812ec0c Mon Sep 17 00:00:00 2001 From: dextmorgn Date: Thu, 12 Feb 2026 22:01:26 +0100 Subject: [PATCH] feat(types): unique webtracker label --- flowsint-types/src/flowsint_types/web_tracker.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/flowsint-types/src/flowsint_types/web_tracker.py b/flowsint-types/src/flowsint_types/web_tracker.py index f55f65b..e29aecf 100644 --- a/flowsint-types/src/flowsint_types/web_tracker.py +++ b/flowsint-types/src/flowsint_types/web_tracker.py @@ -1,5 +1,6 @@ +from typing import List, Optional, Self + from pydantic import Field, model_validator -from typing import Optional, List, Self from .flowsint_base import FlowsintType from .registry import flowsint_type @@ -10,7 +11,10 @@ class WebTracker(FlowsintType): """Represents a web tracking technology with privacy and compliance information.""" tracker_id: str = Field( - ..., description="Unique tracker identifier", title="Tracker ID", json_schema_extra={"primary": True} + ..., + description="Unique tracker identifier", + title="Tracker ID", + json_schema_extra={"primary": True}, ) name: Optional[str] = Field(None, description="Tracker name", title="Name") type: Optional[str] = Field( @@ -62,10 +66,10 @@ class WebTracker(FlowsintType): None, description="Privacy risk level", title="Risk Level" ) - @model_validator(mode='after') + @model_validator(mode="after") def compute_label(self) -> Self: if self.name: - self.nodeLabel = self.name + self.nodeLabel = f"{self.name}-{self.tracker_id}" else: self.nodeLabel = self.tracker_id return self