specification icon indicating copy to clipboard operation
specification copied to clipboard

[Defect]: JS functional tests fail for 2.0 (schema path + Ajv 2020-12 meta-schema)

Open Mehrn0ush opened this issue 9 months ago • 1 comments

Describe the defect

tools/src/test/js/json-schema-functional-tests.js fails when run with -v 2.0.

There are two concrete causes:

  1. Schema path mismatch The harness currently expects schema/bom-2.0.schema.json, but the CycloneDX 2.0 schema is located under schema/2.0/ (e.g. schema/2.0/cyclonedx-2.0.schema.json).

  2. Ajv draft 2020-12 meta-schema not loaded When compiling the 2.0 schema (which declares $schema: https://json-schema.org/draft/2020-12/schema), Ajv throws: Error: no schema with key or ref "https://json-schema.org/draft/2020-12/schema"

This prevents functional validation of the 2.0 test vectors under tools/src/test/resources/2.0.

  1. 2.0 cryptography test vectors out of sync with schema A few 2.0 "valid-*" cryptography examples use string values where the bundled 2.0 schema defines arrays (e.g. algorithmProperties.implementationPlatform and securedBy.algorithmRef). These vectors fail validation until updated to match the schema.

Steps to reproduce

From repo root:

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

Proposed fix:
Update the affected 2.0 cryptography test vectors to align with the bundled schema (wrap single values in one-element arrays).

Mehrn0ush avatar Feb 21 '26 12:02 Mehrn0ush

fixed

jkowalleck avatar Sep 10 '26 16:09 jkowalleck