-
-
Notifications
You must be signed in to change notification settings - Fork 88
Added support for conditional components and associated unit tests #929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
stevespringett
wants to merge
2
commits into
2.0-dev
Choose a base branch
from
2.0-dev-conditional-components
base: 2.0-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
tools/src/test/resources/2.0/invalid-component-choice-additional-property-2.0.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", | ||
| "specFormat": "CycloneDX", | ||
| "specVersion": "2.0", | ||
| "version": 1, | ||
| "metadata": { | ||
| "component": { | ||
| "type": "device", | ||
| "name": "Acme Product" | ||
| } | ||
| }, | ||
| "components": [ | ||
| { | ||
| "type": "component-choice", | ||
| "name": "Transistor Choice", | ||
| "description": "unexpected property `supplier`", | ||
| "operator": "XOR", | ||
| "supplier": { "name": "`supplier` is not allowed on a choice wrapper" }, | ||
| "components": [ | ||
| { "type": "device", "name": "Transistor A" }, | ||
| { "type": "device", "name": "Transistor B" } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
24 changes: 24 additions & 0 deletions
24
tools/src/test/resources/2.0/invalid-component-choice-bad-operator-2.0.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", | ||
| "specFormat": "CycloneDX", | ||
| "specVersion": "2.0", | ||
| "version": 1, | ||
| "metadata": { | ||
| "component": { | ||
| "type": "device", | ||
| "name": "Acme Product" | ||
| } | ||
| }, | ||
| "components": [ | ||
| { | ||
| "type": "component-choice", | ||
| "name": "Transistor Choice", | ||
|
stevespringett marked this conversation as resolved.
|
||
| "description": "unexpected value for `operator`", | ||
| "operator": "NAND", | ||
| "components": [ | ||
| { "type": "device", "name": "Transistor A" }, | ||
| { "type": "device", "name": "Transistor B" } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
22 changes: 22 additions & 0 deletions
22
tools/src/test/resources/2.0/invalid-component-choice-missing-name-2.0.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", | ||
| "specFormat": "CycloneDX", | ||
| "specVersion": "2.0", | ||
| "version": 1, | ||
| "metadata": { | ||
| "component": { | ||
| "type": "device", | ||
| "name": "Acme Product" | ||
| } | ||
| }, | ||
| "components": [ | ||
| { | ||
| "type": "component-choice", | ||
|
stevespringett marked this conversation as resolved.
|
||
| "operator": "XOR", | ||
| "components": [ | ||
| { "type": "device", "name": "Transistor A" }, | ||
| { "type": "device", "name": "Transistor B" } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
23 changes: 23 additions & 0 deletions
23
tools/src/test/resources/2.0/invalid-component-choice-missing-operator-2.0.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", | ||
| "specFormat": "CycloneDX", | ||
| "specVersion": "2.0", | ||
| "version": 1, | ||
| "metadata": { | ||
| "component": { | ||
| "type": "device", | ||
| "name": "Acme Product" | ||
| } | ||
| }, | ||
| "components": [ | ||
| { | ||
| "type": "component-choice", | ||
| "name": "Transistor Choice", | ||
|
stevespringett marked this conversation as resolved.
|
||
| "description": "missing property `operator`", | ||
| "components": [ | ||
| { "type": "device", "name": "Transistor A" }, | ||
| { "type": "device", "name": "Transistor B" } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
24 changes: 24 additions & 0 deletions
24
tools/src/test/resources/2.0/invalid-component-choice-optional-operator-2.0.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", | ||
| "specFormat": "CycloneDX", | ||
| "specVersion": "2.0", | ||
| "version": 1, | ||
| "metadata": { | ||
| "component": { | ||
| "type": "device", | ||
| "name": "Acme Product" | ||
| } | ||
| }, | ||
| "components": [ | ||
| { | ||
| "type": "component-choice", | ||
| "name": "JP2 Debug Header", | ||
|
stevespringett marked this conversation as resolved.
|
||
| "description": "invalid value for `operator`", | ||
| "operator": "OPTIONAL", | ||
| "components": [ | ||
| { "type": "device", "name": "Debug Header A" }, | ||
| { "type": "device", "name": "Debug Header B" } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
23 changes: 23 additions & 0 deletions
23
tools/src/test/resources/2.0/invalid-component-choice-too-few-2.0.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", | ||
| "specFormat": "CycloneDX", | ||
| "specVersion": "2.0", | ||
| "version": 1, | ||
| "metadata": { | ||
| "component": { | ||
| "type": "device", | ||
| "name": "Acme Product" | ||
| } | ||
| }, | ||
| "components": [ | ||
| { | ||
| "type": "component-choice", | ||
| "name": "Transistor Choice", | ||
|
stevespringett marked this conversation as resolved.
|
||
| "description": "`components` must list at least two items", | ||
| "operator": "XOR", | ||
| "components": [ | ||
| { "type": "device", "name": "Lone Transistor" } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
33 changes: 33 additions & 0 deletions
33
tools/src/test/resources/2.0/valid-component-choice-and-2.0.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", | ||
| "specFormat": "CycloneDX", | ||
| "specVersion": "2.0", | ||
| "version": 1, | ||
| "metadata": { | ||
| "component": { | ||
| "bom-ref": "rf-board", | ||
| "type": "device", | ||
| "name": "RF Front End Board" | ||
| } | ||
| }, | ||
| "components": [ | ||
| { | ||
| "type": "component-choice", | ||
| "name": "Transceiver and Matching Balun", | ||
| "description": "The transceiver and its matching balun are installed together. Selecting one without the other yields a non-functional radio.", | ||
| "operator": "AND", | ||
| "components": [ | ||
| { | ||
| "type": "device", | ||
| "name": "2.4GHz RF Transceiver", | ||
| "supplier": { "name": "Acme RF" } | ||
| }, | ||
| { | ||
| "type": "device", | ||
| "name": "Matching Balun for 2.4GHz Transceiver", | ||
| "supplier": { "name": "Acme RF" } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
42 changes: 42 additions & 0 deletions
42
tools/src/test/resources/2.0/valid-component-choice-in-nested-components-2.0.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { | ||
| "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", | ||
| "specFormat": "CycloneDX", | ||
| "specVersion": "2.0", | ||
| "version": 1, | ||
| "metadata": { | ||
| "component": { | ||
| "bom-ref": "main-board", | ||
| "type": "device", | ||
| "name": "Main Board" | ||
| } | ||
| }, | ||
| "components": [ | ||
| { | ||
| "type": "device", | ||
| "name": "Power Management Sub-board", | ||
| "components": [ | ||
| { | ||
| "type": "device", | ||
| "name": "Input Diode" | ||
| }, | ||
| { | ||
| "type": "component-choice", | ||
| "name": "U1 5V LDO Regulator", | ||
| "operator": "XOR", | ||
| "components": [ | ||
| { | ||
| "type": "device", | ||
| "name": "LD1117S50TR", | ||
| "supplier": { "name": "STMicroelectronics" } | ||
| }, | ||
| { | ||
| "type": "device", | ||
| "name": "AMS1117-5.0", | ||
| "supplier": { "name": "Advanced Monolithic Systems" } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
57 changes: 57 additions & 0 deletions
57
tools/src/test/resources/2.0/valid-component-choice-nested-2.0.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| { | ||
| "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", | ||
| "specFormat": "CycloneDX", | ||
| "specVersion": "2.0", | ||
| "version": 1, | ||
| "metadata": { | ||
| "component": { | ||
| "bom-ref": "radio-module", | ||
| "type": "device", | ||
| "name": "Radio Module" | ||
| } | ||
| }, | ||
| "components": [ | ||
| { | ||
| "type": "component-choice", | ||
| "name": "Radio Subsystem", | ||
| "description": "Choose exactly one radio subsystem. Each option is itself a tightly coupled group of transceiver and matching balun that must be installed together.", | ||
| "operator": "XOR", | ||
| "components": [ | ||
| { | ||
| "type": "component-choice", | ||
| "name": "2.4GHz Radio Group", | ||
| "operator": "AND", | ||
| "components": [ | ||
| { | ||
| "type": "device", | ||
| "name": "2.4GHz Transceiver", | ||
| "supplier": { "name": "Acme RF" } | ||
| }, | ||
| { | ||
| "type": "device", | ||
| "name": "2.4GHz Balun", | ||
| "supplier": { "name": "Acme RF" } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "type": "component-choice", | ||
| "name": "Sub-GHz Radio Group", | ||
| "operator": "AND", | ||
| "components": [ | ||
| { | ||
| "type": "device", | ||
| "name": "915MHz Transceiver", | ||
| "supplier": { "name": "Beta RF" } | ||
| }, | ||
| { | ||
| "type": "device", | ||
| "name": "915MHz Balun", | ||
| "supplier": { "name": "Beta RF" } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.