Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions cyclonedx/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ class DataClassification:
"""
This is our internal representation of the `dataClassificationType` complex type within the CycloneDX standard.
DataClassification might be deprecated since CycloneDX 1.5, but it is not deprecated in this library.
In fact, this library will try to provide a compatibility layer if needed.
.. note::
See the CycloneDX Schema for dataClassificationType:
https://cyclonedx.org/docs/1.6/xml/#type_dataClassificationType
Expand Down
6 changes: 6 additions & 0 deletions cyclonedx/model/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

from collections.abc import Iterable
from typing import Any, Optional, Union
from warnings import warn

import py_serializable as serializable
from sortedcontainers import SortedSet
Expand Down Expand Up @@ -61,6 +62,7 @@ def __init__(
endpoints: Optional[Iterable[XsUri]] = None,
authenticated: Optional[bool] = None,
x_trust_boundary: Optional[bool] = None,
# Deprecated since v1.5
data: Optional[Iterable[DataClassification]] = None,
licenses: Optional[Iterable[License]] = None,
external_references: Optional[Iterable[ExternalReference]] = None,
Expand Down Expand Up @@ -259,6 +261,10 @@ def data(self) -> 'SortedSet[DataClassification]':

@data.setter
def data(self, data: Iterable[DataClassification]) -> None:
if data:
warn('`@.data` is deprecated from CycloneDX v1.5 onwards. '
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revertred. adding new warnings is not in the scope of the ticket, nor shall it be part of this very PR.

please create a new ticket/PR for this topic.

'Alternative implementation is planned for future versions.',
DeprecationWarning)
self._data = SortedSet(data)

@property
Expand Down
11 changes: 11 additions & 0 deletions cyclonedx/model/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
from py_serializable.helpers import BaseHelper
from sortedcontainers import SortedSet

try:
from warnings import deprecated
except ImportError:
from typing_extensions import deprecated

from .._internal.compare import ComparableTuple as _ComparableTuple
from ..schema import SchemaVersion
from ..schema.schema import SchemaVersion1Dot4, SchemaVersion1Dot5, SchemaVersion1Dot6
Expand All @@ -37,6 +42,12 @@
from py_serializable import ObjectMetadataLibrary, ViewType


@deprecated(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted, as the added statement is not true. the data model itself was never deprecated. it is just the usage in another model, that is deprecated in certain versions of CycloneDX.

'`Tool` is deprecated from CycloneDX v1.5 onwards. '
'This class provides a compatibility layer for backward compatibility '
'Use `Component` or `Service` instead, and store data under '
'`tools.components` or `tools.services`.'
)
@serializable.serializable_class
class Tool:
"""
Expand Down
7 changes: 7 additions & 0 deletions cyclonedx/serialization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@
from packageurl import PackageURL
from py_serializable.helpers import BaseHelper

try:
from warnings import deprecated
except ImportError:
from typing_extensions import deprecated

from ..exception.serialization import CycloneDxDeserializationException, SerializationOfUnexpectedValueException
from ..model.bom_ref import BomRef
from ..model.license import _LicenseRepositorySerializationHelper


@deprecated('Use :class:`BomRef` instead.')
class BomRefHelper(BaseHelper):
"""**DEPRECATED** in favour of :class:`BomRef`.

Expand Down Expand Up @@ -88,6 +94,7 @@ def deserialize(cls, o: Any) -> UUID:
) from err


@deprecated('No public API planned for replacing this,')
class LicenseRepositoryHelper(_LicenseRepositorySerializationHelper):
"""**DEPRECATED**

Expand Down