Skip to content

Commit

Permalink
Add CycloneDX v1.5 JSON schema and update resource config (CycloneDX#41)
Browse files Browse the repository at this point in the history
* Add CycloneDX v1.5 JSON schema and update resource config

Signed-off-by: Matt Rutkowski <mrutkows@us.ibm.com>

* Add minimal tests for 1.5 schema

Signed-off-by: Matt Rutkowski <mrutkows@us.ibm.com>

* Add minimal tests for 1.5 schema

Signed-off-by: Matt Rutkowski <mrutkows@us.ibm.com>

---------

Signed-off-by: Matt Rutkowski <mrutkows@us.ibm.com>
Signed-off-by: ajistrying <ajistrying@gmail.com>
  • Loading branch information
mrutkows authored and ajistrying committed Jun 29, 2023
1 parent 2c7ffbc commit ac55960
Show file tree
Hide file tree
Showing 6 changed files with 4,021 additions and 7 deletions.
28 changes: 27 additions & 1 deletion cmd/validate_cdx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ const (
// CycloneDX - Test versioned documents meet min. schema requirements
TEST_CDX_1_3_MIN_REQUIRED = "test/cyclonedx/cdx-1-3-min-required.json"
TEST_CDX_1_4_MIN_REQUIRED = "test/cyclonedx/cdx-1-4-min-required.json"
TEST_CDX_1_5_MIN_REQUIRED = "test/cyclonedx/cdx-1-5-min-required.json"
)

// Mature SBOMs used to test various schemas and queries
const (
TEST_CDX_1_3_MATURITY_EXAMPLE_1_BASE = "test/cyclonedx/cdx-1-3-mature-example-1.json"
TEST_CDX_1_4_MATURITY_EXAMPLE_1_BASE = "test/cyclonedx/cdx-1-4-mature-example-1.json"
TEST_CDX_1_5_MATURITY_EXAMPLE_1_BASE = "test/cyclonedx/cdx-1-5-mature-example-1.json"
)

const (
// (invalid) schema tests
TEST_SCHEMA_CDX_1_3_INVALID_LICENSE_CHOICE = "test/cyclonedx/cdx-1-3-invalid-license-choice-oneof.json"
TEST_SCHEMA_CDX_1_3_INVALID_LICENSE_ID = "test/cyclonedx/cdx-1-3-invalid-spdx-license-id.json"
Expand All @@ -33,7 +43,7 @@ const (
)

// -----------------------------------------------------------
// CycloneDX - Min. req. tests
// CycloneDX - Min. requirement & Mature tests
// -----------------------------------------------------------

func TestValidateCdx13MinRequiredBasic(t *testing.T) {
Expand All @@ -44,6 +54,22 @@ func TestValidateCdx14MinRequiredBasic(t *testing.T) {
innerValidateError(t, TEST_CDX_1_4_MIN_REQUIRED, SCHEMA_VARIANT_NONE, FORMAT_TEXT, nil)
}

func TestValidateCdx15MinRequiredBasic(t *testing.T) {
innerValidateError(t, TEST_CDX_1_5_MIN_REQUIRED, SCHEMA_VARIANT_NONE, FORMAT_TEXT, nil)
}

func TestValidateCdx13Mature(t *testing.T) {
innerValidateError(t, TEST_CDX_1_3_MATURITY_EXAMPLE_1_BASE, SCHEMA_VARIANT_NONE, FORMAT_TEXT, nil)
}

func TestValidateCdx14MMature(t *testing.T) {
innerValidateError(t, TEST_CDX_1_4_MATURITY_EXAMPLE_1_BASE, SCHEMA_VARIANT_NONE, FORMAT_TEXT, nil)
}

func TestValidateCdx15Mature(t *testing.T) {
innerValidateError(t, TEST_CDX_1_5_MATURITY_EXAMPLE_1_BASE, SCHEMA_VARIANT_NONE, FORMAT_TEXT, nil)
}

// -----------------------------------------------------------
// CycloneDX - (invalid) schema tests
// -----------------------------------------------------------
Expand Down
6 changes: 0 additions & 6 deletions cmd/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ const (
TEST_CDX_1_3_SYNTAX_ERR_2 = "test/cyclonedx/cdx-1-3-syntax-err-2.json"
)

// Mature SBOMs used to test various schemas and queries
const (
TEST_CDX_1_3_MATURITY_EXAMPLE_1_BASE = "test/cyclonedx/cdx-1-3-mature-example-1.json"
TEST_CDX_1_4_MATURITY_EXAMPLE_1_BASE = "test/cyclonedx/cdx-1-4-mature-example-1.json"
)

const (
TEST_CDX_1_4_VALIDATE_ERR_COMPONENTS_UNIQUE = "test/validation/cdx-1-4-validate-err-components-unique-items-1.json"
TEST_CDX_1_4_VALIDATE_ERR_FORMAT_IRI_REFERENCE = "test/validation/cdx-1-4-validate-err-components-format-iri-reference.json"
Expand Down
9 changes: 9 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@
"url": "https://raw.githubusercontent.com/CycloneDX/specification/v1.5-dev/schema/bom-1.5.schema.json",
"default": false
},
{
"version": "1.5",
"variant": "",
"name": "CycloneDX v1.5",
"file": "schema/cyclonedx/1.5/bom-1.5.schema.json",
"development": "https://github.com/CycloneDX/specification/blob/master/schema/bom-1.5.schema.json",
"url": "https://raw.githubusercontent.com/CycloneDX/specification/master/schema/bom-1.5.schema.json",
"default": false
},
{
"version": "1.3",
"variant": "custom",
Expand Down
Loading

0 comments on commit ac55960

Please sign in to comment.