hoppr-cyclonedx-models 0.6.1__tar.gz → 0.6.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of hoppr-cyclonedx-models might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hoppr-cyclonedx-models
3
- Version: 0.6.1
3
+ Version: 0.6.2
4
4
  Summary: CycloneDX Pydantic models for easy use in your Python project.
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -81,4 +81,4 @@ class Sbom(Sbom_1_5, Sbom_1_4, Sbom_1_3): # pylint: disable=too-few-public-meth
81
81
  return Sbom_1_5(**sbom).dict(exclude_none=True, exclude_unset=True)
82
82
 
83
83
 
84
- __version__ = "0.6.1"
84
+ __version__ = "0.6.2"
@@ -1,6 +1,6 @@
1
1
  """
2
2
  --------------------------------------------------------------------------------
3
- SPDX-FileCopyrightText: Copyright © 2025 Lockheed Martin <open.source@lmco.com>
3
+ SPDX-FileCopyrightText: Copyright © 2024 Lockheed Martin <open.source@lmco.com>
4
4
  SPDX-FileName: hoppr_cyclonedx_models/cyclonedx_1_3.py
5
5
  SPDX-FileType: SOURCE
6
6
  SPDX-License-Identifier: MIT
@@ -25,15 +25,15 @@ THE SOFTWARE.
25
25
  --------------------------------------------------------------------------------
26
26
  This file was generated by datamodel-codegen:
27
27
  filename: bom-1.3.schema.json
28
- timestamp: 2025-09-17T19:02:47+00:00
29
- version: 0.25.7
28
+ timestamp: 2024-07-15T17:53:40+00:00
29
+ version: 0.21.5
30
30
  """
31
31
 
32
32
  from __future__ import annotations
33
33
 
34
34
  from datetime import datetime
35
35
  from enum import Enum
36
- from typing import List, Optional, Union
36
+ from typing import List, Optional
37
37
 
38
38
  from pydantic import EmailStr, Field
39
39
  from typing_extensions import Annotated, Literal
@@ -390,48 +390,19 @@ class Hash(CycloneDXBaseModel):
390
390
  ]
391
391
 
392
392
 
393
- class License1(CycloneDXBaseModel):
394
- id: Annotated[
395
- spdx.LicenseID, Field(description="A valid SPDX license ID", examples=["Apache-2.0"], title="License ID (SPDX)")
396
- ]
397
- name: Annotated[
398
- Optional[str],
399
- Field(
400
- description="If SPDX does not define the license used, this field may be used to provide the license name",
401
- examples=["Acme Software License"],
402
- title="License Name",
403
- ),
404
- ] = None
405
- text: Annotated[
406
- Optional[Attachment],
407
- Field(description="An optional way to include the textual content of a license.", title="License text"),
408
- ] = None
409
- url: Annotated[
410
- Optional[str],
411
- Field(
412
- description=(
413
- "The URL to the license file. If specified, a 'license' externalReference should also be specified for"
414
- " completeness"
415
- ),
416
- examples=["https://www.apache.org/licenses/LICENSE-2.0.txt"],
417
- title="License URL",
418
- ),
419
- ] = None
420
-
421
-
422
- class License2(CycloneDXBaseModel):
393
+ class License(CycloneDXBaseModel):
423
394
  id: Annotated[
424
395
  Optional[spdx.LicenseID],
425
396
  Field(description="A valid SPDX license ID", examples=["Apache-2.0"], title="License ID (SPDX)"),
426
397
  ] = None
427
398
  name: Annotated[
428
- str,
399
+ Optional[str],
429
400
  Field(
430
401
  description="If SPDX does not define the license used, this field may be used to provide the license name",
431
402
  examples=["Acme Software License"],
432
403
  title="License Name",
433
404
  ),
434
- ]
405
+ ] = None
435
406
  text: Annotated[
436
407
  Optional[Attachment],
437
408
  Field(description="An optional way to include the textual content of a license.", title="License text"),
@@ -449,8 +420,8 @@ class License2(CycloneDXBaseModel):
449
420
  ] = None
450
421
 
451
422
 
452
- class LicenseChoice1(CycloneDXBaseModel):
453
- license: Annotated[Union[License1, License2], Field(title="License Object")]
423
+ class LicenseChoice(CycloneDXBaseModel):
424
+ license: Optional[License] = None
454
425
  expression: Annotated[
455
426
  Optional[str],
456
427
  Field(
@@ -460,17 +431,6 @@ class LicenseChoice1(CycloneDXBaseModel):
460
431
  ] = None
461
432
 
462
433
 
463
- class LicenseChoice2(CycloneDXBaseModel):
464
- license: Annotated[Optional[Union[License1, License2]], Field(title="License Object")] = None
465
- expression: Annotated[
466
- str,
467
- Field(
468
- examples=["Apache-2.0 AND (MIT OR GPL-2.0-only)", "GPL-3.0-only WITH Classpath-exception-2.0"],
469
- title="SPDX License Expression",
470
- ),
471
- ]
472
-
473
-
474
434
  class Commit(CycloneDXBaseModel):
475
435
  """
476
436
  Specifies an individual commit
@@ -567,9 +527,7 @@ class ComponentEvidence(CycloneDXBaseModel):
567
527
  Provides the ability to document evidence collected through various forms of extraction or analysis.
568
528
  """
569
529
 
570
- licenses: Annotated[
571
- Optional[List[Union[LicenseChoice1, LicenseChoice2]]], Field(title="Component License(s)")
572
- ] = None
530
+ licenses: Annotated[Optional[List[LicenseChoice]], Field(title="Component License(s)")] = None
573
531
  copyright: Annotated[Optional[List[Copyright]], Field(title="Copyright")] = None
574
532
 
575
533
 
@@ -704,9 +662,7 @@ class Service(CycloneDXBaseModel):
704
662
  Optional[List[DataClassification]],
705
663
  Field(description="Specifies the data classification.", title="Data Classification"),
706
664
  ] = None
707
- licenses: Annotated[
708
- Optional[List[Union[LicenseChoice1, LicenseChoice2]]], Field(title="Component License(s)")
709
- ] = None
665
+ licenses: Annotated[Optional[List[LicenseChoice]], Field(title="Component License(s)")] = None
710
666
  externalReferences: Annotated[Optional[List[ExternalReference]], Field(title="External References")] = None
711
667
  services: Annotated[Optional[List[Service]], Field(title="Services")] = None
712
668
  properties: Annotated[
@@ -851,7 +807,7 @@ class Metadata(CycloneDXBaseModel):
851
807
  title="Supplier",
852
808
  ),
853
809
  ] = None
854
- licenses: Annotated[Optional[List[Union[LicenseChoice1, LicenseChoice2]]], Field(title="BOM License(s)")] = None
810
+ licenses: Annotated[Optional[List[LicenseChoice]], Field(title="BOM License(s)")] = None
855
811
  properties: Annotated[
856
812
  Optional[List[Property]],
857
813
  Field(
@@ -1045,9 +1001,7 @@ class Component(CycloneDXBaseModel):
1045
1001
  ),
1046
1002
  ] = Scope.required
1047
1003
  hashes: Annotated[Optional[List[Hash]], Field(title="Component Hashes")] = None
1048
- licenses: Annotated[
1049
- Optional[List[Union[LicenseChoice1, LicenseChoice2]]], Field(title="Component License(s)")
1050
- ] = None
1004
+ licenses: Annotated[Optional[List[LicenseChoice]], Field(title="Component License(s)")] = None
1051
1005
  copyright: Annotated[
1052
1006
  Optional[str],
1053
1007
  Field(
@@ -1,6 +1,6 @@
1
1
  """
2
2
  --------------------------------------------------------------------------------
3
- SPDX-FileCopyrightText: Copyright © 2025 Lockheed Martin <open.source@lmco.com>
3
+ SPDX-FileCopyrightText: Copyright © 2024 Lockheed Martin <open.source@lmco.com>
4
4
  SPDX-FileName: hoppr_cyclonedx_models/cyclonedx_1_4.py
5
5
  SPDX-FileType: SOURCE
6
6
  SPDX-License-Identifier: MIT
@@ -25,8 +25,8 @@ THE SOFTWARE.
25
25
  --------------------------------------------------------------------------------
26
26
  This file was generated by datamodel-codegen:
27
27
  filename: bom-1.4.schema.json
28
- timestamp: 2025-09-17T19:02:47+00:00
29
- version: 0.25.7
28
+ timestamp: 2024-07-15T17:53:40+00:00
29
+ version: 0.21.5
30
30
  """
31
31
 
32
32
  from __future__ import annotations
@@ -504,6 +504,19 @@ class Advisory(CycloneDXBaseModel):
504
504
  url: Annotated[str, Field(description="Location where the advisory can be obtained.", title="URL")]
505
505
 
506
506
 
507
+ Cwe = Annotated[
508
+ int,
509
+ Field(
510
+ description=(
511
+ "Integer representation of a Common Weaknesses Enumerations (CWE). For example 399 (of"
512
+ " https://cwe.mitre.org/data/definitions/399.html)"
513
+ ),
514
+ ge=1,
515
+ title="CWE",
516
+ ),
517
+ ]
518
+
519
+
507
520
  class Severity(Enum):
508
521
  """
509
522
  Textual representation of the severity of the vulnerability adopted by the analysis method. If the analysis method uses values other than what is provided, the user is expected to translate appropriately.
@@ -699,6 +712,18 @@ class Analysis(CycloneDXBaseModel):
699
712
  ] = None
700
713
 
701
714
 
715
+ class Affect(CycloneDXBaseModel):
716
+ class Config:
717
+ extra = Extra.forbid
718
+
719
+ ref: Annotated[
720
+ str, Field(description="References a component or service by the objects bom-ref", title="Reference")
721
+ ]
722
+ versions: Annotated[
723
+ Optional[List], Field(description="Zero or more individual versions or range of versions.", title="Versions")
724
+ ] = None
725
+
726
+
702
727
  class AffectedStatus(Enum):
703
728
  """
704
729
  The vulnerability status of a given version or range of versions of a product. The statuses 'affected' and 'unaffected' indicate that the version is affected or unaffected by the vulnerability. The status 'unknown' indicates that it is unknown or unspecified whether the given version is affected. There can be many reasons for an 'unknown' status, including that an investigation has not been undertaken or that a vendor has not disclosed the status.
@@ -716,7 +741,25 @@ class AffectedStatus(Enum):
716
741
  return next((member for member in cls if member.name in {str(value), str(value).upper()}), None)
717
742
 
718
743
 
719
- class Algorithm(Enum):
744
+ Version = Annotated[
745
+ str, Field(description="A single version of a component or service.", max_length=1024, min_length=1)
746
+ ]
747
+
748
+
749
+ Range = Annotated[
750
+ str,
751
+ Field(
752
+ description=(
753
+ "A version range specified in Package URL Version Range syntax (vers) which is defined at"
754
+ " https://github.com/package-url/purl-spec/VERSION-RANGE-SPEC.rst"
755
+ ),
756
+ max_length=1024,
757
+ min_length=1,
758
+ ),
759
+ ]
760
+
761
+
762
+ class AlgorithmEnum(Enum):
720
763
  """
721
764
  Signature algorithm. The currently recognized JWA [RFC7518] and RFC8037 [RFC8037] asymmetric key algorithms. Note: Unlike RFC8037 [RFC8037] JSF requires explicit Ed* algorithm names instead of "EdDSA".
722
765
  """
@@ -834,39 +877,7 @@ class Hash(CycloneDXBaseModel):
834
877
  ]
835
878
 
836
879
 
837
- class License1(CycloneDXBaseModel):
838
- class Config:
839
- extra = Extra.forbid
840
-
841
- id: Annotated[
842
- spdx.LicenseID, Field(description="A valid SPDX license ID", examples=["Apache-2.0"], title="License ID (SPDX)")
843
- ]
844
- name: Annotated[
845
- Optional[str],
846
- Field(
847
- description="If SPDX does not define the license used, this field may be used to provide the license name",
848
- examples=["Acme Software License"],
849
- title="License Name",
850
- ),
851
- ] = None
852
- text: Annotated[
853
- Optional[Attachment],
854
- Field(description="An optional way to include the textual content of a license.", title="License text"),
855
- ] = None
856
- url: Annotated[
857
- Optional[str],
858
- Field(
859
- description=(
860
- "The URL to the license file. If specified, a 'license' externalReference should also be specified for"
861
- " completeness"
862
- ),
863
- examples=["https://www.apache.org/licenses/LICENSE-2.0.txt"],
864
- title="License URL",
865
- ),
866
- ] = None
867
-
868
-
869
- class License2(CycloneDXBaseModel):
880
+ class License(CycloneDXBaseModel):
870
881
  class Config:
871
882
  extra = Extra.forbid
872
883
 
@@ -875,13 +886,13 @@ class License2(CycloneDXBaseModel):
875
886
  Field(description="A valid SPDX license ID", examples=["Apache-2.0"], title="License ID (SPDX)"),
876
887
  ] = None
877
888
  name: Annotated[
878
- str,
889
+ Optional[str],
879
890
  Field(
880
891
  description="If SPDX does not define the license used, this field may be used to provide the license name",
881
892
  examples=["Acme Software License"],
882
893
  title="License Name",
883
894
  ),
884
- ]
895
+ ] = None
885
896
  text: Annotated[
886
897
  Optional[Attachment],
887
898
  Field(description="An optional way to include the textual content of a license.", title="License text"),
@@ -899,11 +910,11 @@ class License2(CycloneDXBaseModel):
899
910
  ] = None
900
911
 
901
912
 
902
- class LicenseChoice1(CycloneDXBaseModel):
913
+ class LicenseChoice(CycloneDXBaseModel):
903
914
  class Config:
904
915
  extra = Extra.forbid
905
916
 
906
- license: Annotated[Union[License1, License2], Field(title="License Object")]
917
+ license: Optional[License] = None
907
918
  expression: Annotated[
908
919
  Optional[str],
909
920
  Field(
@@ -913,20 +924,6 @@ class LicenseChoice1(CycloneDXBaseModel):
913
924
  ] = None
914
925
 
915
926
 
916
- class LicenseChoice2(CycloneDXBaseModel):
917
- class Config:
918
- extra = Extra.forbid
919
-
920
- license: Annotated[Optional[Union[License1, License2]], Field(title="License Object")] = None
921
- expression: Annotated[
922
- str,
923
- Field(
924
- examples=["Apache-2.0 AND (MIT OR GPL-2.0-only)", "GPL-3.0-only WITH Classpath-exception-2.0"],
925
- title="SPDX License Expression",
926
- ),
927
- ]
928
-
929
-
930
927
  class Commit(CycloneDXBaseModel):
931
928
  """
932
929
  Specifies an individual commit
@@ -1069,9 +1066,7 @@ class ComponentEvidence(CycloneDXBaseModel):
1069
1066
  class Config:
1070
1067
  extra = Extra.forbid
1071
1068
 
1072
- licenses: Annotated[
1073
- Optional[List[Union[LicenseChoice1, LicenseChoice2]]], Field(title="Component License(s)")
1074
- ] = None
1069
+ licenses: Annotated[Optional[List[LicenseChoice]], Field(title="Component License(s)")] = None
1075
1070
  copyright: Annotated[Optional[List[Copyright]], Field(title="Copyright")] = None
1076
1071
 
1077
1072
 
@@ -1130,70 +1125,11 @@ class Credits(CycloneDXBaseModel):
1130
1125
  ] = None
1131
1126
 
1132
1127
 
1133
- class Versions(CycloneDXBaseModel):
1134
- class Config:
1135
- extra = Extra.forbid
1136
-
1137
- version: Annotated[
1138
- str, Field(description="A single version of a component or service.", max_length=1024, min_length=1)
1139
- ]
1140
- range: Annotated[
1141
- Optional[str],
1142
- Field(
1143
- description=(
1144
- "A version range specified in Package URL Version Range syntax (vers) which is defined at"
1145
- " https://github.com/package-url/purl-spec/VERSION-RANGE-SPEC.rst"
1146
- ),
1147
- max_length=1024,
1148
- min_length=1,
1149
- ),
1150
- ] = None
1151
- status: Annotated[
1152
- Optional[AffectedStatus], Field(description="The vulnerability status for the version or range of versions.")
1153
- ] = AffectedStatus.affected
1154
-
1155
-
1156
- class Versions1(CycloneDXBaseModel):
1157
- class Config:
1158
- extra = Extra.forbid
1159
-
1160
- version: Annotated[
1161
- Optional[str], Field(description="A single version of a component or service.", max_length=1024, min_length=1)
1162
- ] = None
1163
- range: Annotated[
1164
- str,
1165
- Field(
1166
- description=(
1167
- "A version range specified in Package URL Version Range syntax (vers) which is defined at"
1168
- " https://github.com/package-url/purl-spec/VERSION-RANGE-SPEC.rst"
1169
- ),
1170
- max_length=1024,
1171
- min_length=1,
1172
- ),
1173
- ]
1174
- status: Annotated[
1175
- Optional[AffectedStatus], Field(description="The vulnerability status for the version or range of versions.")
1176
- ] = AffectedStatus.affected
1177
-
1178
-
1179
- class Affect(CycloneDXBaseModel):
1180
- class Config:
1181
- extra = Extra.forbid
1182
-
1183
- ref: Annotated[
1184
- str, Field(description="References a component or service by the objects bom-ref", title="Reference")
1185
- ]
1186
- versions: Annotated[
1187
- Optional[List[Union[Versions, Versions1]]],
1188
- Field(description="Zero or more individual versions or range of versions.", title="Versions"),
1189
- ] = None
1190
-
1191
-
1192
1128
  class Signer(CycloneDXBaseModel):
1193
1129
  class Config:
1194
1130
  extra = Extra.forbid
1195
1131
 
1196
- algorithm: Union[Algorithm, AnyUrl]
1132
+ algorithm: Union[AlgorithmEnum, AnyUrl]
1197
1133
  keyId: Annotated[
1198
1134
  Optional[str],
1199
1135
  Field(description="Optional. Application specific string identifying the signature key.", title="Key ID"),
@@ -1309,14 +1245,13 @@ class Vulnerability(CycloneDXBaseModel):
1309
1245
  Optional[List[Rating]], Field(description="List of vulnerability ratings", title="Ratings")
1310
1246
  ] = None
1311
1247
  cwes: Annotated[
1312
- Optional[List[int]],
1248
+ Optional[List[Cwe]],
1313
1249
  Field(
1314
1250
  description=(
1315
1251
  "List of Common Weaknesses Enumerations (CWEs) codes that describes this vulnerability. For example 399"
1316
1252
  " (of https://cwe.mitre.org/data/definitions/399.html)"
1317
1253
  ),
1318
1254
  examples=[399],
1319
- ge=1,
1320
1255
  title="CWEs",
1321
1256
  ),
1322
1257
  ] = None
@@ -1505,9 +1440,7 @@ class Service(CycloneDXBaseModel):
1505
1440
  Optional[List[DataClassification]],
1506
1441
  Field(description="Specifies the data classification.", title="Data Classification"),
1507
1442
  ] = None
1508
- licenses: Annotated[
1509
- Optional[List[Union[LicenseChoice1, LicenseChoice2]]], Field(title="Component License(s)")
1510
- ] = None
1443
+ licenses: Annotated[Optional[List[LicenseChoice]], Field(title="Component License(s)")] = None
1511
1444
  externalReferences: Annotated[
1512
1445
  Optional[List[ExternalReference]],
1513
1446
  Field(
@@ -1758,7 +1691,7 @@ class Metadata(CycloneDXBaseModel):
1758
1691
  title="Supplier",
1759
1692
  ),
1760
1693
  ] = None
1761
- licenses: Annotated[Optional[List[Union[LicenseChoice1, LicenseChoice2]]], Field(title="BOM License(s)")] = None
1694
+ licenses: Annotated[Optional[List[LicenseChoice]], Field(title="BOM License(s)")] = None
1762
1695
  properties: Annotated[
1763
1696
  Optional[List[Property]],
1764
1697
  Field(
@@ -1986,9 +1919,7 @@ class Component(CycloneDXBaseModel):
1986
1919
  ),
1987
1920
  ] = Scope.required
1988
1921
  hashes: Annotated[Optional[List[Hash]], Field(title="Component Hashes")] = None
1989
- licenses: Annotated[
1990
- Optional[List[Union[LicenseChoice1, LicenseChoice2]]], Field(title="Component License(s)")
1991
- ] = None
1922
+ licenses: Annotated[Optional[List[LicenseChoice]], Field(title="Component License(s)")] = None
1992
1923
  copyright: Annotated[
1993
1924
  Optional[str],
1994
1925
  Field(