Skip to content

Commit 88991d2

Browse files
committed
Fix the validate_document following library upgrade #1727
Signed-off-by: tdruez <[email protected]>
1 parent 944f23c commit 88991d2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scanpipe/pipes/cyclonedx.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ def validate_document(document):
123123
The validator is loaded from the document specVersion property.
124124
"""
125125
if isinstance(document, str):
126+
document_str = document
126127
document = json.loads(document)
128+
else:
129+
document_str = json.dumps(document)
127130

128131
spec_version = document.get("specVersion")
129132
if not spec_version:
@@ -132,7 +135,8 @@ def validate_document(document):
132135
schema_version = SchemaVersion.from_version(spec_version)
133136

134137
json_validator = JsonStrictValidator(schema_version)
135-
return json_validator._validata_data(document)
138+
json_validation_errors = json_validator.validate_str(document_str)
139+
return json_validation_errors
136140

137141

138142
def is_cyclonedx_bom(input_location):

0 commit comments

Comments
 (0)