Skip to content

Commit

Permalink
Deprecate system_dependencies
Browse files Browse the repository at this point in the history
This field is obsolete with the addition of `egress` and `ingress`.
  • Loading branch information
PSalant726 committed Sep 19, 2022
1 parent 63d3d77 commit 36638c3
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 10 deletions.
16 changes: 16 additions & 0 deletions src/fideslang/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from enum import Enum
from typing import Dict, List, Optional
from warnings import warn

from pydantic import AnyUrl, BaseModel, Field, HttpUrl, root_validator, validator

Expand Down Expand Up @@ -789,6 +790,21 @@ def privacy_declarations_reference_data_flows(

return value

@validator("system_dependencies")
@classmethod
def deprecate_system_dependencies(cls, value: List[FidesKey]) -> List[FidesKey]:
"""
Warn that the `system_dependencies` field is deprecated, if set.
"""

if value is not None:
warn(
"The system_dependencies field is deprecated, and will be removed in a future version of fideslang. Use the 'egress' and 'ingress` fields instead.",
DeprecationWarning,
)

return value

class Config:
"Class for the System config"
use_enum_values = True
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def resources_dict():
dataset_references=[],
)
],
system_dependencies=[],
),
}
yield resources_dict
Expand Down
1 change: 0 additions & 1 deletion tests/data/failing_dataset_collection_taxonomy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ system:
- customer
dataset_references:
- test_db_dataset_failing_dataset
system_dependencies: []

policy:
- fides_key: primary_privacy_policy
Expand Down
1 change: 0 additions & 1 deletion tests/data/failing_dataset_field_taxonomy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ system:
- customer
dataset_references:
- test_db_dataset_failing_dataset
system_dependencies: []

policy:
- fides_key: primary_privacy_policy
Expand Down
1 change: 0 additions & 1 deletion tests/data/failing_dataset_taxonomy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ system:
- customer
dataset_references:
- test_db_dataset_failing_dataset
system_dependencies: []

policy:
- fides_key: primary_privacy_policy
Expand Down
1 change: 0 additions & 1 deletion tests/data/failing_declaration_taxonomy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ system:
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
data_subjects:
- customer
system_dependencies: []

policy:
- fides_key: primary_privacy_policy
Expand Down
1 change: 0 additions & 1 deletion tests/data/passing_declaration_taxonomy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ system:
data_qualifier: aggregated.anonymized.unlinked_pseudonymized.pseudonymized.identified
data_subjects:
- customer
system_dependencies: []

policy:
- fides_key: primary_privacy_policy
Expand Down
44 changes: 40 additions & 4 deletions tests/fideslang/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,50 @@ def test_system_valid(self) -> None:
)
],
registry_id=1,
system_dependencies=[],
system_type="SYSTEM",
tags=["some", "tags"],
)

def test_system_dependencies_deprecation(self) -> None:
with pytest.deprecated_call(match="system_dependencies"):
assert System(
description="Test Policy",
egress=[
DataFlow(
fides_key="test_system_2",
type="system",
data_categories=[],
)
],
fides_key="test_system",
ingress=[
DataFlow(
fides_key="test_system_3",
type="system",
data_categories=[],
)
],
meta={"some": "meta stuff"},
name="Test System",
organization_fides_key=1,
privacy_declarations=[
PrivacyDeclaration(
data_categories=[],
data_qualifier="aggregated_data",
data_subjects=[],
data_use="provide",
dataset_references=[],
egress=["test_system_2"],
ingress=["test_system_3"],
name="declaration-name",
)
],
registry_id=1,
system_dependencies=[],
system_type="SYSTEM",
tags=["some", "tags"],
)

def test_system_valid_no_egress_or_ingress(self) -> None:
assert System(
description="Test Policy",
Expand All @@ -62,7 +101,6 @@ def test_system_valid_no_egress_or_ingress(self) -> None:
)
],
registry_id=1,
system_dependencies=[],
system_type="SYSTEM",
tags=["some", "tags"],
)
Expand Down Expand Up @@ -95,7 +133,6 @@ def test_system_no_egress(self) -> None:
)
],
registry_id=1,
system_dependencies=[],
system_type="SYSTEM",
tags=["some", "tags"],
)
Expand Down Expand Up @@ -128,7 +165,6 @@ def test_system_no_ingress(self) -> None:
)
],
registry_id=1,
system_dependencies=[],
system_type="SYSTEM",
tags=["some", "tags"],
)

0 comments on commit 36638c3

Please sign in to comment.