@@ -310,7 +310,8 @@ def __init__(self, *, components: Optional[Iterable[Component]] = None,
310310 serial_number : Optional [UUID ] = None , version : int = 1 ,
311311 metadata : Optional [BomMetaData ] = None ,
312312 dependencies : Optional [Iterable [Dependency ]] = None ,
313- vulnerabilities : Optional [Iterable [Vulnerability ]] = None ) -> None :
313+ vulnerabilities : Optional [Iterable [Vulnerability ]] = None ,
314+ properties : Optional [Iterable [Property ]] = None ) -> None :
314315 """
315316 Create a new Bom that you can manually/programmatically add data to later.
316317
@@ -325,6 +326,7 @@ def __init__(self, *, components: Optional[Iterable[Component]] = None,
325326 self .external_references = external_references or [] # type:ignore[assignment]
326327 self .vulnerabilities = vulnerabilities or [] # type:ignore[assignment]
327328 self .dependencies = dependencies or [] # type:ignore[assignment]
329+ self .properties = properties or [] # type:ignore[assignment]
328330
329331 @property
330332 @serializable .type_mapping (UrnUuidHelper )
@@ -364,7 +366,7 @@ def version(self, version: int) -> None:
364366 @serializable .view (SchemaVersion1Dot4 )
365367 @serializable .view (SchemaVersion1Dot5 )
366368 @serializable .view (SchemaVersion1Dot6 )
367- @serializable .xml_sequence (1 )
369+ @serializable .xml_sequence (10 )
368370 def metadata (self ) -> BomMetaData :
369371 """
370372 Get our internal metadata object for this Bom.
@@ -385,7 +387,7 @@ def metadata(self, metadata: BomMetaData) -> None:
385387 @serializable .include_none (SchemaVersion1Dot0 )
386388 @serializable .include_none (SchemaVersion1Dot1 )
387389 @serializable .xml_array (serializable .XmlArraySerializationType .NESTED , 'component' )
388- @serializable .xml_sequence (2 )
390+ @serializable .xml_sequence (20 )
389391 def components (self ) -> 'SortedSet[Component]' :
390392 """
391393 Get all the Components currently in this Bom.
@@ -406,7 +408,7 @@ def components(self, components: Iterable[Component]) -> None:
406408 @serializable .view (SchemaVersion1Dot5 )
407409 @serializable .view (SchemaVersion1Dot6 )
408410 @serializable .xml_array (serializable .XmlArraySerializationType .NESTED , 'service' )
409- @serializable .xml_sequence (3 )
411+ @serializable .xml_sequence (30 )
410412 def services (self ) -> 'SortedSet[Service]' :
411413 """
412414 Get all the Services currently in this Bom.
@@ -428,7 +430,7 @@ def services(self, services: Iterable[Service]) -> None:
428430 @serializable .view (SchemaVersion1Dot5 )
429431 @serializable .view (SchemaVersion1Dot6 )
430432 @serializable .xml_array (serializable .XmlArraySerializationType .NESTED , 'reference' )
431- @serializable .xml_sequence (4 )
433+ @serializable .xml_sequence (40 )
432434 def external_references (self ) -> 'SortedSet[ExternalReference]' :
433435 """
434436 Provides the ability to document external references related to the BOM or to the project the BOM describes.
@@ -449,7 +451,7 @@ def external_references(self, external_references: Iterable[ExternalReference])
449451 @serializable .view (SchemaVersion1Dot5 )
450452 @serializable .view (SchemaVersion1Dot6 )
451453 @serializable .xml_array (serializable .XmlArraySerializationType .NESTED , 'dependency' )
452- @serializable .xml_sequence (5 )
454+ @serializable .xml_sequence (50 )
453455 def dependencies (self ) -> 'SortedSet[Dependency]' :
454456 return self ._dependencies
455457
@@ -470,25 +472,35 @@ def dependencies(self, dependencies: Iterable[Dependency]) -> None:
470472 # def compositions(self, ...) -> None:
471473 # ... # TODO Since CDX 1.3
472474
473- # @property
474- # ...
475- # @serializable.view(SchemaVersion1Dot3)
476- # @serializable.view(SchemaVersion1Dot4)
477- # @serializable.view(SchemaVersion1Dot5)
478- # @serializable.xml_sequence(7)
479- # def properties(self) -> ...:
480- # ... # TODO Since CDX 1.3
481- #
482- # @properties.setter
483- # def properties(self, ...) -> None:
484- # ... # TODO Since CDX 1.3
475+ @property
476+ # @serializable.view(SchemaVersion1Dot3) @todo: Update py-serializable to support view by OutputFormat filtering
477+ # @serializable.view(SchemaVersion1Dot4) @todo: Update py-serializable to support view by OutputFormat filtering
478+ @serializable .view (SchemaVersion1Dot5 )
479+ @serializable .view (SchemaVersion1Dot6 )
480+ @serializable .xml_array (serializable .XmlArraySerializationType .NESTED , 'property' )
481+ @serializable .xml_sequence (70 )
482+ def properties (self ) -> 'SortedSet[Property]' :
483+ """
484+ Provides the ability to document properties in a name/value store. This provides flexibility to include data
485+ not officially supported in the standard without having to use additional namespaces or create extensions.
486+ Property names of interest to the general public are encouraged to be registered in the CycloneDX Property
487+ Taxonomy - https://github.com/CycloneDX/cyclonedx-property-taxonomy. Formal registration is OPTIONAL.
488+
489+ Return:
490+ Set of `Property`
491+ """
492+ return self ._properties
493+
494+ @properties .setter
495+ def properties (self , properties : Iterable [Property ]) -> None :
496+ self ._properties = SortedSet (properties )
485497
486498 @property
487499 @serializable .view (SchemaVersion1Dot4 )
488500 @serializable .view (SchemaVersion1Dot5 )
489501 @serializable .view (SchemaVersion1Dot6 )
490502 @serializable .xml_array (serializable .XmlArraySerializationType .NESTED , 'vulnerability' )
491- @serializable .xml_sequence (8 )
503+ @serializable .xml_sequence (80 )
492504 def vulnerabilities (self ) -> 'SortedSet[Vulnerability]' :
493505 """
494506 Get all the Vulnerabilities in this BOM.
@@ -682,7 +694,8 @@ def __eq__(self, other: object) -> bool:
682694 def __hash__ (self ) -> int :
683695 return hash ((
684696 self .serial_number , self .version , self .metadata , tuple (self .components ), tuple (self .services ),
685- tuple (self .external_references ), tuple (self .vulnerabilities ), tuple (self .dependencies )
697+ tuple (self .external_references ), tuple (self .dependencies ), tuple (self .properties ),
698+ tuple (self .vulnerabilities ),
686699 ))
687700
688701 def __repr__ (self ) -> str :
0 commit comments