Skip to content

Commit 61c5449

Browse files
fix: Add warnings for deprecated usage of dataClassification in old locations
Signed-off-by: Souta Kawahara <[email protected]>
1 parent b50a28a commit 61c5449

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

cyclonedx/model/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ class DataClassification:
7373
"""
7474
This is our internal representation of the `dataClassificationType` complex type within the CycloneDX standard.
7575
76-
DataClassification might be deprecated since CycloneDX 1.5, but it is not deprecated in this library.
77-
In fact, this library will try to provide a compatibility layer if needed.
78-
7976
.. note::
8077
See the CycloneDX Schema for dataClassificationType:
8178
https://cyclonedx.org/docs/1.6/xml/#type_dataClassificationType

cyclonedx/model/service.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def __init__(
6161
endpoints: Optional[Iterable[XsUri]] = None,
6262
authenticated: Optional[bool] = None,
6363
x_trust_boundary: Optional[bool] = None,
64+
# Deprecated since v1.5
6465
data: Optional[Iterable[DataClassification]] = None,
6566
licenses: Optional[Iterable[License]] = None,
6667
external_references: Optional[Iterable[ExternalReference]] = None,
@@ -259,6 +260,10 @@ def data(self) -> 'SortedSet[DataClassification]':
259260

260261
@data.setter
261262
def data(self, data: Iterable[DataClassification]) -> None:
263+
if data:
264+
warn('`@.data` is deprecated from CycloneDX v1.5 onwards. '
265+
'Alternative implementation is planned for future versions.',
266+
DeprecationWarning)
262267
self._data = SortedSet(data)
263268

264269
@property

0 commit comments

Comments
 (0)