The Dependency class currently allows arbitrary nesting, at least according to the type hints:
|
def __init__(self, ref: BomRef, dependencies: Optional[Iterable['Dependency']] = None) -> None: |
|
self.ref = ref |
|
self.dependencies = dependencies or [] |
Serializing such a BOM to JSON will ignore everything except the top-level entry.
Example usage:
bom.dependencies.add(
Dependency(
root_component.bom_ref,
dependencies=[
Dependency(
dependency1.bom_ref,
dependencies=[
Dependency(dependency2.bom_ref)
]
)
]
)
)
I stumbled upon this when trying to process external BOMs for further analysis with only looking at the type hints, while I have not been able to build a BOM myself which would actually trigger this after serialization.