Skip to content

Commit 66f3dbe

Browse files
fholgerarmintaenzertng
authored andcommitted
Fix broken references during bump so that the written test json validates properly against the shacl model. Also fill in required root elements for document.
Signed-off-by: Holger Frydrych <holger.frydrych@tngtech.com>
1 parent 7bef1fe commit 66f3dbe

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/spdx_tools/spdx3/bump_from_spdx2/annotation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def bump_annotation(
4343
spdx_id,
4444
annotation_type,
4545
creation_info=creation_info,
46-
subject=spdx2_annotation.spdx_id,
46+
subject=f"{document_namespace}#{spdx2_annotation.spdx_id}",
4747
statement=spdx2_annotation.annotation_comment,
4848
)
4949
)

src/spdx_tools/spdx3/bump_from_spdx2/creation_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def bump_creation_info(spdx2_creation_info: Spdx2_CreationInfo, payload: Payload
7373
name=spdx2_creation_info.name,
7474
comment=document_comment,
7575
element=[],
76-
root_element=[],
76+
root_element=[spdx_id],
7777
imports=imports,
7878
namespaces=namespaces,
7979
)

src/spdx_tools/spdx3/bump_from_spdx2/relationship.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ def bump_relationship(
204204

205205
return SoftwareDependencyRelationship(
206206
spdx_id,
207-
from_element,
207+
f"{document_namespace}#{from_element}",
208208
relationship_type,
209-
to,
209+
[f"{document_namespace}#{t}" for t in to],
210210
creation_info=creation_info,
211211
comment=spdx2_relationship.comment,
212212
completeness=completeness,
@@ -217,9 +217,9 @@ def bump_relationship(
217217

218218
return Relationship(
219219
spdx_id,
220-
from_element,
220+
f"{document_namespace}#{from_element}",
221221
relationship_type,
222-
to,
222+
[f"{document_namespace}#{t}" for t in to],
223223
creation_info=creation_info,
224224
comment=spdx2_relationship.comment,
225225
completeness=completeness,

0 commit comments

Comments
 (0)