[2.0] fixes on schema and test resources - #1001
Conversation
a03e560 to
905e58a
Compare
- [x] Java tests - functional - [x] JS tests - functional - WIP - found some false-positives/false-negatives - due to errors in test resources - [x] JS tests - schema validate - includes #996 - includes #992 - JS tests - semantics - [x] #998 - [x] #995 - [x] PHP tests - functional added tests only, no schema/res fixes - they are prepared in - #997 - #1001 --------- Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
| "$ref": "#/$defs/timestamp/$defs/withMilliseconds", | ||
| "title": "Created Timestamp", | ||
| "description": "The time at which this signature was originally created. The creator can use any time it deems most appropriate as the time the signature was created, but it MUST be precise to the nearest millisecond (exactly three digits after the decimal place in seconds). The created property MUST NOT be changed when creating a new version of the signature.", | ||
| "$comment": "Normative source: ITU-T X.590 clause 6.3.1", |
There was a problem hiding this comment.
consolidated to #/$defs/timestamp/$defs/withMilliseconds
| "title": "Modified Timestamp", | ||
| "description": "The time that this particular version of the signature was last modified. The creator can use any time it deems most appropriate as the time that this version of the signature was modified, but it MUST be precise to the nearest millisecond (exactly three digits after the decimal place in seconds). The modified property MUST be later than or equal to the value of the created property. If the created and modified properties are the same, then this is the first version of the signature.", | ||
| "$comment": "Normative source: ITU-T X.590 clause 6.3.1. Cross-field invariant: 'modified' MUST be greater than or equal to 'created'. JSON Schema 2020-12 cannot compare two sibling property values, so this constraint is NOT enforced by this schema and MUST be validated by the consuming tool or conformance suite.", | ||
| "pattern": "^[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])T(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}Z$" |
There was a problem hiding this comment.
consolidated to #/$defs/timestamp/$defs/withMilliseconds
There was a problem hiding this comment.
file was removed, since the relevant test case did not exist.
the componentCHoice does not require/have a name
❓ was this intentional/correct
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
There was a problem hiding this comment.
Pull request overview
Updates the CycloneDX 2.0 JSON schemas and test fixtures to align with recent model changes (notably parties, signatures, extensible properties, and stricter schema semantics), and extends the JS semantic test suite to enforce additional schema invariants.
Changes:
- Refactors many 2.0 test resources from legacy fields (e.g.,
publisher,supplier,manufacturer,authors,signature) to 2.0 structures (parties,signatures), and corrects cryptography-related shapes. - Tightens/clarifies schema semantics (e.g.,
additionalProperties: falsein more places, explicit property presence inoneOf/anyOfbranches,refLinkTypeusage). - Adds extensible-properties valid/invalid fixtures and adjusts JS semantic tests for the updated schema patterns.
Reviewed changes
Copilot reviewed 49 out of 49 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/src/test/resources/2.0/valid-standard-2.0.json | Updates signature fixture to signatures[] and new JSS field names. |
| tools/src/test/resources/2.0/valid-service-2.0.json | Migrates publisher to parties role-based representation. |
| tools/src/test/resources/2.0/valid-perspective-2.0.json | Migrates supplier to parties role-based representation. |
| tools/src/test/resources/2.0/valid-patent-2.0.json | Migrates manufacturer to parties and updates organization URL structure. |
| tools/src/test/resources/2.0/valid-machine-learning-considerations-env-2.0.json | Migrates supplier/publisher to parties. |
| tools/src/test/resources/2.0/valid-machine-learning-2.0.json | Migrates publisher to parties. |
| tools/src/test/resources/2.0/valid-license-name-with-text-2.0.json | Migrates publisher to parties. |
| tools/src/test/resources/2.0/valid-license-name-with-licensing-2.0.json | Migrates publisher to parties. |
| tools/src/test/resources/2.0/valid-license-name-2.0.json | Migrates publisher to parties. |
| tools/src/test/resources/2.0/valid-license-id-with-text-2.0.json | Migrates publisher to parties. |
| tools/src/test/resources/2.0/valid-license-id-2.0.json | Migrates publisher to parties. |
| tools/src/test/resources/2.0/valid-license-expression-with-licensing-2.0.json | Migrates publisher to parties. |
| tools/src/test/resources/2.0/valid-license-expression-2.0.json | Migrates publisher to parties. |
| tools/src/test/resources/2.0/valid-license-choice-2.0.json | Migrates publisher to parties. |
| tools/src/test/resources/2.0/valid-formulation-2.0.json | Migrates publisher to parties. |
| tools/src/test/resources/2.0/valid-external-reference-2.0.json | Migrates publisher to parties and adds new externalReference types. |
| tools/src/test/resources/2.0/valid-extensible-properties.json | Adds a valid extensible-properties fixture (new file). |
| tools/src/test/resources/2.0/valid-cryptography-implementation-2.0.json | Updates cryptography fixtures to match schema (e.g., arrays where required). |
| tools/src/test/resources/2.0/valid-cryptography-full-2.0.json | Updates cryptography fixtures (e.g., arrays for refs/platform). |
| tools/src/test/resources/2.0/valid-cryptography-certificate-advanced-2.0.json | Updates certificate fixtures and adds algorithm asset + algorithmRef arrays. |
| tools/src/test/resources/2.0/valid-cryptography-certificate-2.0.json | Fixes ref and expands crypto assets; updates platform arrays. |
| tools/src/test/resources/2.0/valid-component-swid-full-2.0.json | Migrates authors to parties with author role. |
| tools/src/test/resources/2.0/valid-component-swid-2.0.json | Migrates authors to parties with author role. |
| tools/src/test/resources/2.0/valid-component-choice-xor-2.0.json | Migrates supplier to parties for component-choice samples. |
| tools/src/test/resources/2.0/valid-component-choice-or-2.0.json | Migrates supplier to parties for component-choice samples. |
| tools/src/test/resources/2.0/valid-component-choice-nested-2.0.json | Migrates nested supplier to nested parties. |
| tools/src/test/resources/2.0/valid-component-choice-in-nested-components-2.0.json | Migrates nested supplier to nested parties. |
| tools/src/test/resources/2.0/valid-component-choice-and-2.0.json | Migrates supplier to parties for AND operator sample. |
| tools/src/test/resources/2.0/valid-bom-2.0.json | Broad migration of manufacturer/supplier/authors/publisher to parties, including contacts and URLs. |
| tools/src/test/resources/2.0/valid-attestation-2.0.json | Migrates multiple signature objects to signatures[] throughout. |
| tools/src/test/resources/2.0/invalid-extensible-properties.json | Adds invalid extensible-properties fixture (new file). |
| tools/src/test/resources/2.0/invalid-component-choice-missing-name-2.0.json | Removes an invalid test resource fixture. |
| tools/src/test/js/schema-v2/json-schema-semantic-tests.js | Updates semantic tests for refLinkType exception and additionalProperties handling. |
| schema/2.0/model/cyclonedx-vulnerability-2.0.schema.json | Adds additionalProperties: false and fixes required-property existence assertions. |
| schema/2.0/model/cyclonedx-patent-2.0.schema.json | Switches certain refs from refType to refLinkType. |
| schema/2.0/model/cyclonedx-party-2.0.schema.json | Makes oneOf branches explicitly assert the required property exists. |
| schema/2.0/model/cyclonedx-metadata-2.0.schema.json | Adds additionalProperties: false to an object schema. |
| schema/2.0/model/cyclonedx-license-2.0.schema.json | Makes oneOf branches explicitly assert the required property exists. |
| schema/2.0/model/cyclonedx-jss_X590_2023_10-2.0.schema.json | Consolidates millisecond timestamp handling and adds explicit property presence in anyOf. |
| schema/2.0/model/cyclonedx-formulation-2.0.schema.json | Makes oneOf branches explicitly assert the required property exists. |
| schema/2.0/model/cyclonedx-declaration-2.0.schema.json | Adjusts required fields in a oneOf branch (e.g., signatures). |
| schema/2.0/model/cyclonedx-data-2.0.schema.json | Makes oneOf branches explicitly assert the required property exists. |
| schema/2.0/model/cyclonedx-cryptography-2.0.schema.json | Refactors some oneOf branches/types and shifts refs to refLinkType. |
| schema/2.0/model/cyclonedx-component-2.0.schema.json | Improves mutual-exclusion logic annotation and adds property presence to not. |
| schema/2.0/model/cyclonedx-common-2.0.schema.json | Makes refLinkType inheritance explicit; refactors extensible-properties schema; adjusts base mixins; adds placeholder for organizationalEntityOrContact. |
| schema/2.0/model/cyclonedx-citation-2.0.schema.json | Makes anyOf/oneOf branches explicitly assert required property exists. |
| schema/2.0/model/cyclonedx-annotation-2.0.schema.json | Makes oneOf branches explicitly assert required property exists. |
| schema/2.0/model/cyclonedx-ai-modelcard-2.0.schema.json | Removes redundant type alongside $ref. |
| schema/2.0/cyclonedx-2.0.schema.json | Replaces root additionalProperties: false with unevaluatedProperties: false to support extensibility mixins. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
fixes or related to
additionalProperties=false#995requiredproperties actually exist #996bom-refmust be of typerefType#998besides those fixes above, this is in the PR:
refLinkTypeinherit explicitextensibleProertiesJSS$commentsextensiblePropertiesinvalid-component-choice-missing-name-2.0.json- as thenamewas optional or did not exist.❓ was this intentional/correct
tests for the things are based on: