Skip to content

Commit

Permalink
Merge branch 'main' into feat/bom.definitions-full
Browse files Browse the repository at this point in the history
  • Loading branch information
jkowalleck committed Jan 20, 2025
2 parents e104148 + 6003feb commit 0d7b205
Show file tree
Hide file tree
Showing 16 changed files with 181 additions and 168 deletions.
26 changes: 13 additions & 13 deletions cyclonedx/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class DataFlow(str, Enum):
This is our internal representation of the dataFlowType simple type within the CycloneDX standard.
.. note::
See the CycloneDX Schema: https://cyclonedx.org/docs/1.4/xml/#type_dataFlowType
See the CycloneDX Schema: https://cyclonedx.org/docs/1.6/xml/#type_dataFlowType
"""
INBOUND = 'inbound'
OUTBOUND = 'outbound'
Expand All @@ -82,7 +82,7 @@ class DataClassification:
.. note::
See the CycloneDX Schema for dataClassificationType:
https://cyclonedx.org/docs/1.4/xml/#type_dataClassificationType
https://cyclonedx.org/docs/1.6/xml/#type_dataClassificationType
"""

def __init__(
Expand Down Expand Up @@ -160,7 +160,7 @@ class Encoding(str, Enum):
This is our internal representation of the encoding simple type within the CycloneDX standard.
.. note::
See the CycloneDX Schema: https://cyclonedx.org/docs/1.4/#type_encoding
See the CycloneDX Schema: https://cyclonedx.org/docs/1.6/#type_encoding
"""
BASE_64 = 'base64'

Expand All @@ -171,7 +171,7 @@ class AttachedText:
This is our internal representation of the `attachedTextType` complex type within the CycloneDX standard.
.. note::
See the CycloneDX Schema for hashType: https://cyclonedx.org/docs/1.3/#type_attachedTextType
See the CycloneDX Schema for hashType: https://cyclonedx.org/docs/1.6/#type_attachedTextType
"""

DEFAULT_CONTENT_TYPE = 'text/plain'
Expand Down Expand Up @@ -263,7 +263,7 @@ class HashAlgorithm(str, Enum):
This is our internal representation of the hashAlg simple type within the CycloneDX standard.
.. note::
See the CycloneDX Schema: https://cyclonedx.org/docs/1.3/#type_hashAlg
See the CycloneDX Schema: https://cyclonedx.org/docs/1.6/#type_hashAlg
"""
# see `_HashTypeRepositorySerializationHelper.__CASES` for view/case map
BLAKE2B_256 = 'BLAKE2b-256' # Only supported in >= 1.2
Expand Down Expand Up @@ -386,7 +386,7 @@ class HashType:
This is our internal representation of the hashType complex type within the CycloneDX standard.
.. note::
See the CycloneDX Schema for hashType: https://cyclonedx.org/docs/1.3/#type_hashType
See the CycloneDX Schema for hashType: https://cyclonedx.org/docs/1.6/#type_hashType
"""

@staticmethod
Expand Down Expand Up @@ -542,7 +542,7 @@ class ExternalReferenceType(str, Enum):
Enum object that defines the permissible 'types' for an External Reference according to the CycloneDX schema.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.3/#type_externalReferenceType
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/#type_externalReferenceType
"""
# see `_ExternalReferenceSerializationHelper.__CASES` for view/case map
ADVERSARY_MODEL = 'adversary-model' # Only supported in >= 1.5
Expand Down Expand Up @@ -810,7 +810,7 @@ class ExternalReference:
a CycloneDX BOM document.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.3/#type_externalReference
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/#type_externalReference
"""

def __init__(
Expand Down Expand Up @@ -923,7 +923,7 @@ class Property:
a CycloneDX BOM document.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_propertyType
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/xml/#type_propertyType
Specifies an individual property with a name and value.
"""
Expand Down Expand Up @@ -997,7 +997,7 @@ class NoteText:
a CycloneDX BOM document.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_releaseNotesType
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/xml/#type_releaseNotesType
"""

DEFAULT_CONTENT_TYPE: str = 'text/plain'
Expand Down Expand Up @@ -1088,7 +1088,7 @@ class Note:
a CycloneDX BOM document.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_releaseNotesType
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/xml/#type_releaseNotesType
@todo: Replace ``NoteText`` with ``AttachedText``?
"""
Expand Down Expand Up @@ -1171,7 +1171,7 @@ class IdentifiableAction:
This is our internal representation of the `identifiableActionType` complex type.
.. note::
See the CycloneDX specification: https://cyclonedx.org/docs/1.4/xml/#type_identifiableActionType
See the CycloneDX specification: https://cyclonedx.org/docs/1.6/xml/#type_identifiableActionType
"""

def __init__(
Expand Down Expand Up @@ -1261,7 +1261,7 @@ class Copyright:
This is our internal representation of the `copyrightsType` complex type.
.. note::
See the CycloneDX specification: https://cyclonedx.org/docs/1.4/xml/#type_copyrightsType
See the CycloneDX specification: https://cyclonedx.org/docs/1.6/xml/#type_copyrightsType
"""

def __init__(
Expand Down
10 changes: 5 additions & 5 deletions cyclonedx/model/bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
SchemaVersion1Dot5,
SchemaVersion1Dot6,
)
from ..serialization import LicenseRepositoryHelper, UrnUuidHelper
from ..serialization import UrnUuidHelper
from . import _BOM_LINK_PREFIX, ExternalReference, Property
from .bom_ref import BomRef
from .component import Component
from .contact import OrganizationalContact, OrganizationalEntity
from .definition import Definitions
from .dependency import Dependable, Dependency
from .license import License, LicenseExpression, LicenseRepository
from .license import License, LicenseExpression, LicenseRepository, _LicenseRepositorySerializationHelper
from .lifecycle import Lifecycle, LifecycleRepository, _LifecycleRepositoryHelper
from .service import Service
from .tool import Tool, ToolRepository, _ToolRepositoryHelper
Expand All @@ -59,7 +59,7 @@ class BomMetaData:
This is our internal representation of the metadata complex type within the CycloneDX standard.
.. note::
See the CycloneDX Schema for Bom metadata: https://cyclonedx.org/docs/1.5/#type_metadata
See the CycloneDX Schema for Bom metadata: https://cyclonedx.org/docs/1.6/#type_metadata
"""

def __init__(
Expand Down Expand Up @@ -254,7 +254,7 @@ def supplier(self, supplier: Optional[OrganizationalEntity]) -> None:
@serializable.view(SchemaVersion1Dot4)
@serializable.view(SchemaVersion1Dot5)
@serializable.view(SchemaVersion1Dot6)
@serializable.type_mapping(LicenseRepositoryHelper)
@serializable.type_mapping(_LicenseRepositorySerializationHelper)
@serializable.xml_sequence(9)
def licenses(self) -> LicenseRepository:
"""
Expand Down Expand Up @@ -394,7 +394,7 @@ def metadata(self) -> BomMetaData:
Metadata object instance for this Bom.
.. note::
See the CycloneDX Schema for Bom metadata: https://cyclonedx.org/docs/1.3/#type_metadata
See the CycloneDX Schema for Bom metadata: https://cyclonedx.org/docs/1.6/#type_metadata
"""
return self._metadata

Expand Down
30 changes: 15 additions & 15 deletions cyclonedx/model/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
SchemaVersion1Dot5,
SchemaVersion1Dot6,
)
from ..serialization import BomRefHelper, LicenseRepositoryHelper, PackageUrl as PackageUrlSH
from ..serialization import PackageUrl as PackageUrlSH
from . import (
AttachedText,
Copyright,
Expand All @@ -61,7 +61,7 @@
from .crypto import CryptoProperties
from .dependency import Dependable
from .issue import IssueType
from .license import License, LicenseRepository
from .license import License, LicenseRepository, _LicenseRepositorySerializationHelper
from .release_note import ReleaseNotes


Expand All @@ -71,7 +71,7 @@ class Commit:
Our internal representation of the `commitType` complex type.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_commitType
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/xml/#type_commitType
"""

def __init__(
Expand Down Expand Up @@ -200,7 +200,7 @@ class ComponentEvidence:
Provides the ability to document evidence collected through various forms of extraction or analysis.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_componentEvidenceType
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/xml/#type_componentEvidenceType
"""

def __init__(
Expand Down Expand Up @@ -250,7 +250,7 @@ def __init__(
# ... # TODO since CDX1.5

@property
@serializable.type_mapping(LicenseRepositoryHelper)
@serializable.type_mapping(_LicenseRepositorySerializationHelper)
@serializable.xml_sequence(4)
def licenses(self) -> LicenseRepository:
"""
Expand Down Expand Up @@ -299,7 +299,7 @@ class ComponentScope(str, Enum):
Enum object that defines the permissable 'scopes' for a Component according to the CycloneDX schema.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.3/#type_scope
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/#type_scope
"""
# see `_ComponentScopeSerializationHelper.__CASES` for view/case map
REQUIRED = 'required'
Expand Down Expand Up @@ -355,7 +355,7 @@ class ComponentType(str, Enum):
Enum object that defines the permissible 'types' for a Component according to the CycloneDX schema.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.3/#type_classification
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/#type_classification
"""
# see `_ComponentTypeSerializationHelper.__CASES` for view/case map
APPLICATION = 'application'
Expand Down Expand Up @@ -434,7 +434,7 @@ class Diff:
Our internal representation of the `diffType` complex type.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_diffType
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/xml/#type_diffType
"""

def __init__(
Expand Down Expand Up @@ -505,7 +505,7 @@ class PatchClassification(str, Enum):
Enum object that defines the permissible `patchClassification`s.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_patchClassification
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/xml/#type_patchClassification
"""
BACKPORT = 'backport'
CHERRY_PICK = 'cherry-pick'
Expand All @@ -519,7 +519,7 @@ class Patch:
Our internal representation of the `patchType` complex type.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_patchType
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/xml/#type_patchType
"""

def __init__(
Expand Down Expand Up @@ -612,7 +612,7 @@ class Pedigree:
may not be known.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_pedigreeType
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/xml/#type_pedigreeType
"""

def __init__(
Expand Down Expand Up @@ -769,7 +769,7 @@ class Swid:
Our internal representation of the `swidType` complex type.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_swidType
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/xml/#type_swidType
"""

def __init__(
Expand Down Expand Up @@ -1029,7 +1029,7 @@ class Component(Dependable):
This is our internal representation of a Component within a Bom.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.3/#type_component
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/#type_component
"""

@staticmethod
Expand Down Expand Up @@ -1171,7 +1171,7 @@ def mime_type(self, mime_type: Optional[str]) -> None:

@property
@serializable.json_name('bom-ref')
@serializable.type_mapping(BomRefHelper)
@serializable.type_mapping(BomRef)
@serializable.view(SchemaVersion1Dot1)
@serializable.view(SchemaVersion1Dot2)
@serializable.view(SchemaVersion1Dot3)
Expand Down Expand Up @@ -1407,7 +1407,7 @@ def hashes(self, hashes: Iterable[HashType]) -> None:
@serializable.view(SchemaVersion1Dot4)
@serializable.view(SchemaVersion1Dot5)
@serializable.view(SchemaVersion1Dot6)
@serializable.type_mapping(LicenseRepositoryHelper)
@serializable.type_mapping(_LicenseRepositorySerializationHelper)
@serializable.xml_sequence(12)
def licenses(self) -> LicenseRepository:
"""
Expand Down
7 changes: 3 additions & 4 deletions cyclonedx/model/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from .._internal.compare import ComparableTuple as _ComparableTuple
from ..exception.model import NoPropertiesProvidedException
from ..schema.schema import SchemaVersion1Dot6
from ..serialization import BomRefHelper
from . import XsUri
from .bom_ref import BomRef

Expand Down Expand Up @@ -60,7 +59,7 @@ def __init__(

@property
@serializable.json_name('bom-ref')
@serializable.type_mapping(BomRefHelper)
@serializable.type_mapping(BomRef)
@serializable.xml_attribute()
@serializable.xml_name('bom-ref')
def bom_ref(self) -> Optional[BomRef]:
Expand Down Expand Up @@ -194,7 +193,7 @@ class OrganizationalContact:
within a CycloneDX BOM document.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_organizationalContact
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/xml/#type_organizationalContact
"""

def __init__(
Expand Down Expand Up @@ -287,7 +286,7 @@ class OrganizationalEntity:
within a CycloneDX BOM document.
.. note::
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.4/xml/#type_organizationalEntity
See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.6/xml/#type_organizationalEntity
"""

def __init__(
Expand Down
9 changes: 4 additions & 5 deletions cyclonedx/model/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
from .._internal.compare import ComparableTuple as _ComparableTuple
from ..exception.model import InvalidNistQuantumSecurityLevelException, InvalidRelatedCryptoMaterialSizeException
from ..schema.schema import SchemaVersion1Dot6
from ..serialization import BomRefHelper
from .bom_ref import BomRef


Expand Down Expand Up @@ -606,7 +605,7 @@ def not_valid_after(self, not_valid_after: Optional[datetime]) -> None:
self._not_valid_after = not_valid_after

@property
@serializable.type_mapping(BomRefHelper)
@serializable.type_mapping(BomRef)
@serializable.xml_sequence(50)
def signature_algorithm_ref(self) -> Optional[BomRef]:
"""
Expand All @@ -622,7 +621,7 @@ def signature_algorithm_ref(self, signature_algorithm_ref: Optional[BomRef]) ->
self._signature_algorithm_ref = signature_algorithm_ref

@property
@serializable.type_mapping(BomRefHelper)
@serializable.type_mapping(BomRef)
@serializable.xml_sequence(60)
def subject_public_key_ref(self) -> Optional[BomRef]:
"""
Expand Down Expand Up @@ -775,7 +774,7 @@ def mechanism(self, mechanism: Optional[str]) -> None:
self._mechanism = mechanism

@property
@serializable.type_mapping(BomRefHelper)
@serializable.type_mapping(BomRef)
@serializable.xml_sequence(20)
def algorithm_ref(self) -> Optional[BomRef]:
"""
Expand Down Expand Up @@ -888,7 +887,7 @@ def state(self, state: Optional[RelatedCryptoMaterialState]) -> None:
self._state = state

@property
@serializable.type_mapping(BomRefHelper)
@serializable.type_mapping(BomRef)
@serializable.xml_sequence(40)
def algorithm_ref(self) -> Optional[BomRef]:
"""
Expand Down
2 changes: 1 addition & 1 deletion cyclonedx/model/definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def __repr__(self) -> str:

@property
@serializable.json_name('bom-ref')
@serializable.type_mapping(BomRefHelper)
@serializable.type_mapping(BomRef)
@serializable.xml_attribute()
@serializable.xml_name('bom-ref')
def bom_ref(self) -> BomRef:
Expand Down
Loading

0 comments on commit 0d7b205

Please sign in to comment.