diff --git a/.github/workflows/bundle_2.0_schemas.yml b/.github/workflows/bundle_2.0_schemas.yml index fe800caf..aa562cdc 100644 --- a/.github/workflows/bundle_2.0_schemas.yml +++ b/.github/workflows/bundle_2.0_schemas.yml @@ -7,7 +7,7 @@ on: - 2.0-dev-threatmodeling paths: - 'schema/2.0/**/*.schema.json' - - 'tools/src/main/js/bundle-schemas.js' + - 'tools/src/main/js/bundler/bundle-schemas.js' workflow_dispatch: # Allows manual trigger jobs: @@ -29,30 +29,31 @@ jobs: node-version: '20' - name: Install dependencies - working-directory: tools/src/main/js + working-directory: tools/src/main/js/bundler run: npm install - name: Bundle schemas - working-directory: tools/src/main/js + working-directory: tools/src/main/js/bundler run: | node bundle-schemas.js \ - ../../../../schema/2.0/model \ - ../../../../schema/2.0/cyclonedx-2.0.schema.json + ../../../../../schema/2.0/model \ + ../../../../../schema/2.0/cyclonedx-2.0.schema.json - name: Check for changes and commit run: | BUNDLED_FILE="schema/2.0/cyclonedx-2.0-bundled.schema.json" + MINIFIED_FILE="schema/2.0/cyclonedx-2.0-bundled.min.schema.json" - # Add the file (works for both new and modified files) - git add "$BUNDLED_FILE" + # Add both files (works for both new and modified files) + git add "$BUNDLED_FILE" "$MINIFIED_FILE" # Check if there are staged changes if git diff --staged --quiet; then - echo "No changes to bundled schema" + echo "No changes to bundled schemas" else echo "Committing bundled schema changes" git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" - git commit -m "chore: update bundled schema [skip ci]" + git commit -m "chore: update bundled schemas [skip ci]" git push fi diff --git a/docgen/json/gen.sh b/docgen/json/gen.sh index 4eb65326..66db731f 100755 --- a/docgen/json/gen.sh +++ b/docgen/json/gen.sh @@ -2,6 +2,7 @@ set -eu declare -a CDX_VERSIONS=( + '2.0' '1.7' '1.6' '1.5' @@ -44,11 +45,15 @@ generate () { local title="CycloneDX v${version} JSON Reference" echo "Generating: $title" - local SCHEMA_FILE="$SCHEMA_PATH/bom-${version}.schema.json" - local STRICT_SCHEMA_FILE="$SCHEMA_PATH/bom-${version}-strict.schema.json" - if [ -f "$STRICT_SCHEMA_FILE" ] - then + local SCHEMA_FILE + if [[ "$version" == 1.* ]]; then + SCHEMA_FILE="$SCHEMA_PATH/bom-${version}.schema.json" + local STRICT_SCHEMA_FILE="$SCHEMA_PATH/bom-${version}-strict.schema.json" + if [ -f "$STRICT_SCHEMA_FILE" ]; then SCHEMA_FILE="$STRICT_SCHEMA_FILE" + fi + else + SCHEMA_FILE="$SCHEMA_PATH/${version}/cyclonedx-${version}-bundled.schema.json" fi echo "SCHEMA_FILE: $SCHEMA_FILE" diff --git a/docgen/json/requirements.txt b/docgen/json/requirements.txt index d5e43567..dbb2b26d 100644 --- a/docgen/json/requirements.txt +++ b/docgen/json/requirements.txt @@ -1 +1 @@ -json-schema-for-humans==1.3.4 +json-schema-for-humans==1.5.1 diff --git a/docgen/json/templates/cyclonedx/base.html b/docgen/json/templates/cyclonedx/base.html index fd480909..48dc68ef 100644 --- a/docgen/json/templates/cyclonedx/base.html +++ b/docgen/json/templates/cyclonedx/base.html @@ -40,6 +40,8 @@ v${version} (JSON)