Skip to content

Commit 223ebf7

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

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
from collections.abc import Iterable
2828
from typing import Any, Optional, Union
29+
from warnings import warn
2930

3031
import py_serializable as serializable
3132
from sortedcontainers import SortedSet
@@ -61,6 +62,7 @@ def __init__(
6162
endpoints: Optional[Iterable[XsUri]] = None,
6263
authenticated: Optional[bool] = None,
6364
x_trust_boundary: Optional[bool] = None,
65+
# Deprecated since v1.5
6466
data: Optional[Iterable[DataClassification]] = None,
6567
licenses: Optional[Iterable[License]] = None,
6668
external_references: Optional[Iterable[ExternalReference]] = None,
@@ -259,6 +261,10 @@ def data(self) -> 'SortedSet[DataClassification]':
259261

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

264270
@property

0 commit comments

Comments
 (0)