specification icon indicating copy to clipboard operation
specification copied to clipboard

fix(tests): enable JS functional tests for CycloneDX 2.0

Open Mehrn0ush opened this issue 9 months ago • 0 comments

What

Fixes the JS functional test harness for CycloneDX 2.0:

  • Resolve the correct 2.0 schema (schema/2.0/cyclonedx-2.0-bundled.schema.json) when running -v 2.0.
  • Use the Ajv 2020-12 build for 2.0 schemas.
  • Register referenced schemas under both http and https IDs to avoid ref resolution mismatches.
  • Align 2.0 cryptography "valid-*" test vectors with the bundled schema by wrapping single values in one-element arrays:
    • components[].cryptoProperties.algorithmProperties.implementationPlatform
    • components[].cryptoProperties.securedBy[].algorithmRef

Why

node tools/src/test/js/json-schema-functional-tests.js -v 2.0 previously failed due to:

  • outdated schema path assumptions (schema/bom-2.0.schema.json)
  • missing draft 2020-12 meta-schema support in Ajv
  • a small mismatch in 2.0 cryptography test vectors where the schema expects arrays

Testing

  • cd tools/src/test/js && npm install && npm test
  • node json-schema-functional-tests.js -v 2.0

Closes #835

Mehrn0ush avatar Feb 21 '26 12:02 Mehrn0ush