You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importjsonfromtypingimportTYPE_CHECKINGfromcyclonedx.exceptionimportMissingOptionalDependencyExceptionfromcyclonedx.model.bomimportBomfromcyclonedx.schemaimportSchemaVersionfromcyclonedx.validation.jsonimportJsonStrictValidatormy_json_validator=JsonStrictValidator(SchemaVersion.V1_6)
try:
file_path="./test_cylonedx_sbom.json"withopen(file_path) asf:
deserialized_bom=Bom.from_json(data=json.loads(f.read()))
exceptMissingOptionalDependencyExceptionaserror:
print("JSON-validation was skipped due to", error)
Error:
/home/user/fake/path/to/python /home/user/fake/path/to/calculator.py
Traceback (most recent call last):
File "/home/user/fake/path/to/site-packages/serializable/__init__.py", line 324, in from_json
items.append(prop_info.concrete_type.from_json(data=j))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/fake/path/to/site-packages/serializable/__init__.py", line 283, in from_json
for k, v in data.items():
^^^^^^^^^^
AttributeError: 'str' object has no attribute 'items'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/user/fake/path/to/site-packages/serializable/__init__.py", line 333, in from_json
_data[k] = prop_info.concrete_type.from_json(data=v)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/fake/path/to/site-packages/serializable/__init__.py", line 343, in from_json
raise AttributeError(
AttributeError: There was an AttributeError deserializing JSON to <class 'cyclonedx.model.bom.BomMetaData'> the Property <s.oml.SerializableProperty name=tools, custom_names={}, array=True, enum=False, optional=False, c_type=<class 'cyclonedx.model.Tool'>, type=typing.Set[cyclonedx.model.Tool], custom_type=None, xml_attr=False, xml_sequence=3>: 'str' object has no attribute 'items'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/user/fake/path/to/calculator.py", line 49, in <module>
deserialized_bom = Bom.from_json(data=json.loads(f.read()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/fake/path/to/site-packages/serializable/__init__.py", line 343, in from_json
raise AttributeError(
AttributeError: There was an AttributeError deserializing JSON to <class 'cyclonedx.model.bom.Bom'> the Property <s.oml.SerializableProperty name=metadata, custom_names={}, array=False, enum=False, optional=False, c_type=<class 'cyclonedx.model.bom.BomMetaData'>, type=<class 'cyclonedx.model.bom.BomMetaData'>, custom_type=None, xml_attr=False, xml_sequence=10>: There was an AttributeError deserializing JSON to <class 'cyclonedx.model.bom.BomMetaData'> the Property <s.oml.SerializableProperty name=tools, custom_names={}, array=True, enum=False, optional=False, c_type=<class 'cyclonedx.model.Tool'>, type=typing.Set[cyclonedx.model.Tool], custom_type=None, xml_attr=False, xml_sequence=3>: 'str' object has no attribute 'items'
Cannot parse the cyclonedx 1.5 SBOM:
My code:
Error:
CycloneDX SBOM:
The text was updated successfully, but these errors were encountered: