specification
specification copied to clipboard
[Defect]: JS functional tests fail for 2.0 (schema path + Ajv 2020-12 meta-schema)
Describe the defect
tools/src/test/js/json-schema-functional-tests.js fails when run with -v 2.0.
There are two concrete causes:
-
Schema path mismatch The harness currently expects
schema/bom-2.0.schema.json, but the CycloneDX 2.0 schema is located underschema/2.0/(e.g.schema/2.0/cyclonedx-2.0.schema.json). -
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.
- 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.implementationPlatformandsecuredBy.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).
fixed