Skip to content

Commit 21b4d38

Browse files
Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev-threatmodeling
Signed-off-by: Steve Springett <[email protected]> # Conflicts: # schema/2.0/model/cyclonedx-common-2.0.schema.json
2 parents 1bc014f + 6a39e36 commit 21b4d38

File tree

149 files changed

+23269
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+23269
-159
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Bundle CycloneDX 2.0 JSON Schemas
2+
3+
on:
4+
push:
5+
branches:
6+
- 2.0-dev
7+
- 2.0-dev-threatmodeling
8+
paths:
9+
- 'schema/2.0/**/*.schema.json'
10+
- 'tools/src/main/js/bundler/bundle-schemas.js'
11+
workflow_dispatch: # Allows manual trigger
12+
13+
jobs:
14+
bundle-schemas:
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: write # Required to push changes
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20'
30+
31+
- name: Install dependencies
32+
working-directory: tools/src/main/js/bundler
33+
run: npm install
34+
35+
- name: Bundle schemas
36+
working-directory: tools/src/main/js/bundler
37+
run: |
38+
node bundle-schemas.js \
39+
../../../../../schema/2.0/model \
40+
../../../../../schema/2.0/cyclonedx-2.0.schema.json
41+
42+
- name: Check for changes and commit
43+
run: |
44+
BUNDLED_FILE="schema/2.0/cyclonedx-2.0-bundled.schema.json"
45+
MINIFIED_FILE="schema/2.0/cyclonedx-2.0-bundled.min.schema.json"
46+
47+
# Add both files (works for both new and modified files)
48+
git add "$BUNDLED_FILE" "$MINIFIED_FILE"
49+
50+
# Check if there are staged changes
51+
if git diff --staged --quiet; then
52+
echo "No changes to bundled schemas"
53+
else
54+
echo "Committing bundled schema changes"
55+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
56+
git config --local user.name "github-actions[bot]"
57+
git commit -m "chore: update bundled schemas [skip ci]"
58+
git push
59+
fi

docgen/json/gen.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
set -eu
33

44
declare -a CDX_VERSIONS=(
5+
'2.0'
56
'1.7'
67
'1.6'
78
'1.5'
@@ -44,11 +45,15 @@ generate () {
4445
local title="CycloneDX v${version} JSON Reference"
4546
echo "Generating: $title"
4647

47-
local SCHEMA_FILE="$SCHEMA_PATH/bom-${version}.schema.json"
48-
local STRICT_SCHEMA_FILE="$SCHEMA_PATH/bom-${version}-strict.schema.json"
49-
if [ -f "$STRICT_SCHEMA_FILE" ]
50-
then
48+
local SCHEMA_FILE
49+
if [[ "$version" == 1.* ]]; then
50+
SCHEMA_FILE="$SCHEMA_PATH/bom-${version}.schema.json"
51+
local STRICT_SCHEMA_FILE="$SCHEMA_PATH/bom-${version}-strict.schema.json"
52+
if [ -f "$STRICT_SCHEMA_FILE" ]; then
5153
SCHEMA_FILE="$STRICT_SCHEMA_FILE"
54+
fi
55+
else
56+
SCHEMA_FILE="$SCHEMA_PATH/${version}/cyclonedx-${version}-bundled.schema.json"
5257
fi
5358
echo "SCHEMA_FILE: $SCHEMA_FILE"
5459

docgen/json/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
json-schema-for-humans==1.3.4
1+
json-schema-for-humans==1.5.1

docgen/json/templates/cyclonedx/base.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
v${version} (JSON)
4141
</a>
4242
<ul class="dropdown-menu" aria-labelledby="navbarScrollingDropdown">
43+
<li><a class="dropdown-item" href="/docs/2.0/json/">v2.0 (JSON)</a></li>
44+
<li><hr class="dropdown-divider"/></li>
4345
<li><a class="dropdown-item" href="/docs/1.7/json/">v1.7 (JSON)</a></li>
4446
<li><a class="dropdown-item" href="/docs/1.6/json/">v1.6 (JSON)</a></li>
4547
<li><a class="dropdown-item" href="/docs/1.5/json/">v1.5 (JSON)</a></li>

docgen/json/templates/cyclonedx/section_properties.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ <h2 class="mb-0">
1515
</em>
1616
{%- endif -%}
1717
{%- if sub_property.is_required_property -%}
18-
{{ " " }}<span class="badge required-property">Required</span>
18+
{{ " " }}<span class="badge badge-warning required-property">Required</span>
1919
{%- endif -%}
20-
{%- if sub_property is deprecated -%}
21-
{{ " " }}<span class="badge deprecated-property">Deprecated</span>
20+
{%- if sub_property is deprecated or sub_property.kw_deprecated -%}
21+
{{ " " }}<span class="badge badge-danger deprecated-property">Deprecated</span>
2222
{%- endif -%}
2323
{%- if sub_property.is_pattern_property -%}
24-
{{ " " }}<span class="badge pattern-property">Pattern Property</span>
24+
{{ " " }}<span class="badge badge-info pattern-property">Pattern Property</span>
2525
{%- endif -%}
2626
</button>
2727
</h2>
@@ -35,7 +35,7 @@ <h2 class="mb-0">
3535
<h2 class="handle">
3636
<label>Pattern Property</label>
3737
</h2>
38-
<p>All property whose name matches the following regular expression must respect the following conditions</p>
38+
<p>All properties whose name matches the following regular expression must respect the following conditions</p>
3939
<span class="pattern-value">Property name regular expression: <code>{{ sub_property.property_name | escape }}</code></span>
4040
<br/>
4141
{%- endif -%}
@@ -52,4 +52,4 @@ <h2 class="handle">
5252
</div>
5353
</div>
5454
</div>
55-
</div>
55+
</div>

docgen/proto/templates/html.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ https://github.com/pseudomuto/protoc-gen-doc/blob/master/resources/html.tmpl
271271
v${version} (Protobuf)
272272
</a>
273273
<ul class="dropdown-menu" aria-labelledby="navbarScrollingDropdown">
274+
<li><a class="dropdown-item" href="/docs/2.0/json/">v2.0 (JSON)</a></li>
275+
<li><hr class="dropdown-divider"/></li>
274276
<li><a class="dropdown-item" href="/docs/1.7/json/">v1.7 (JSON)</a></li>
275277
<li><a class="dropdown-item" href="/docs/1.6/json/">v1.6 (JSON)</a></li>
276278
<li><a class="dropdown-item" href="/docs/1.5/json/">v1.5 (JSON)</a></li>

docgen/xml/xs3p.xsl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@
340340
<li class="dropdown">
341341
<a href="#" class="dropdown-toggle version-selector" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v<xsl:value-of select="$cycloneDxVersion"/> (XML)<span class="caret"></span></a>
342342
<ul class="dropdown-menu">
343+
<li><a class="dropdown-item" href="/docs/2.0/json/">v2.0 (JSON)</a></li>
344+
<li style="padding:0"><hr class="dropdown-divider"/></li>
343345
<li><a class="dropdown-item" href="/docs/1.7/json/">v1.7 (JSON)</a></li>
344346
<li><a class="dropdown-item" href="/docs/1.6/json/">v1.6 (JSON)</a></li>
345347
<li><a class="dropdown-item" href="/docs/1.5/json/">v1.5 (JSON)</a></li>

schema/2.0/README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
# CycloneDX 2.0 Schemas
22

3-
This directory contains the official JSON Schema definitions for CycloneDX 2.0, as standardised in [ECMA-424](https://ecma-international.org/publications-and-standards/standards/ecma-424/). These schemas constitute the normative implementation of the CycloneDX specification and are intended for use in validation, tooling, and data exchange.
3+
This directory contains the official JSON Schema definitions for CycloneDX 2.0, as standardised in
4+
[ECMA-424](https://ecma-international.org/publications-and-standards/standards/ecma-424/).
5+
These schemas constitute the normative implementation of the CycloneDX specification and are intended for use in
6+
validation, tooling, and data exchange.
47

58
## Schema Overview
69

710
| File | Description |
811
|--------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
912
| [`cyclonedx-2.0.schema.json`](./cyclonedx-2.0.schema.json) | The normative schema for CycloneDX Bill of Materials (BOM) documents. This schema references modular models and defines the complete structure for expressing inventories and metadata. |
13+
| [`cyclonedx-2.0-bundled.schema.json`](./cyclonedx-2.0-bundled.schema.json) | A fully resolved version of the BOM schema with all external model references inlined. Useful for systems that require a self-contained schema. |
1014
| [`cyclonedx-api-2.0.schema.json`](./cyclonedx-api-2.0.schema.json) | The normative API-focused schema. It reuses CycloneDX models but is structured for compatibility with request/response patterns in service architectures. |
11-
| [`cyclonedx-combined-2.0.schema.json`](./cyclonedx-combined-2.0.schema.json) | A fully resolved version of the BOM schema with all external model references inlined. Useful for systems that require a self-contained schema. |
12-
| [`cyclonedx-api-combined-2.0.schema.json`](./cyclonedx-api-combined-2.0.schema.json) | The combined version of the API schema with all model definitions embedded. Suitable for use in tools or validators that do not support `$ref` resolution. |
15+
| [`cyclonedx-api-2.0-bundled.schema.json`](./cyclonedx-api-2.0-bundled.schema.json) | The combined version of the API schema with all model definitions embedded. Suitable for use in tools or validators that do not support `$ref` resolution. |
1316

1417
## Modularity and Model Composition
1518

16-
CycloneDX 2.0 is defined as a modular specification. All core concepts—such as components, services, vulnerabilities, licensing, and AI/ML metadata—are encapsulated in reusable model definitions located in the [`model/`](./model) directory.
19+
CycloneDX 2.0 is defined as a modular specification. All core concepts—such as components, services, vulnerabilities,
20+
licensing, and AI/ML metadata, are encapsulated in reusable model definitions located in the [`model/`](./model) directory.
1721

1822
This modular architecture promotes:
1923

2024
- **Consistency** across multiple schema contexts
2125
- **Reusability** of models within and beyond CycloneDX
2226
- **Clarity and maintainability** for implementers
2327

24-
## Combined Schemas
28+
## Bundled Schemas
2529

26-
The `*-combined` schema files are auto-generated from the normative schemas by resolving all references. These are provided for convenience and do not supersede the authoritative pre-defined schemas.
30+
The `*-bundled` schema files are auto-generated from the normative schemas by resolving all references.
31+
These are provided for convenience and do not supersede the authoritative pre-defined schemas.
2732

2833
## Related Resources
2934

schema/2.0/cyclonedx-2.0-bundled.min.schema.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)