Skip to content

Commit ccbf7b5

Browse files
Merge pull request #121 from CycloneDX/v1.4-dev
v1.4 General Availability
2 parents efe5b9d + ec99395 commit ccbf7b5

File tree

167 files changed

+11160
-43
lines changed

Some content is hidden

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

167 files changed

+11160
-43
lines changed

.github/workflows/cibuild.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI Build
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
PYTHON_VERISON_DEFAULT: "3.10"
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up JDK 1.8
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 1.8
19+
- name: Build with Maven
20+
run: |
21+
cd tools
22+
mvn -B package --file pom.xml
23+
cd ..
24+
- name: Setup Python Environment
25+
# see https://github.com/actions/setup-python
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: ${{ env.PYTHON_VERISON_DEFAULT }}
29+
architecture: 'x64'
30+
- name: Generate JSON Schema documentation
31+
run: |
32+
cd docgen/json
33+
./gen.sh
34+
- name: Generate XML Schema documentation
35+
run: |
36+
cd docgen/xml
37+
./gen.sh
38+
- name: Archive JSON Schema documentation
39+
uses: actions/upload-artifact@v2
40+
with:
41+
name: JSON-Schema-documentation
42+
path: docgen/json/docs
43+
- name: Archive XML Schema documentation
44+
uses: actions/upload-artifact@v2
45+
with:
46+
name: XML-Schema-documentation
47+
path: docgen/xml/docs

.github/workflows/maven.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

docgen/json/gen.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
rm -f -R docs
3+
mkdir -p docs/{1.2,1.3,1.4}
4+
5+
# Check to see if generate-schema-doc is executable and is in the path. If not, install JSON Schema for Humans.
6+
if ! [ -x "$(command -v generate-schema-doc)" ]; then
7+
pip3 install json-schema-for-humans==0.39.5
8+
fi
9+
10+
generate () {
11+
version=$1
12+
title='CycloneDX v'$version' JSON Reference'
13+
echo Generating $title
14+
STRICT_SCHEMA_FILE='../../schema/bom-'$version'-strict.schema.json'
15+
if [ -f "$STRICT_SCHEMA_FILE" ]; then
16+
SCHEMA_FILE='../../schema/bom-'$version'-strict.schema.json'
17+
else
18+
SCHEMA_FILE='../../schema/bom-'$version'.schema.json'
19+
fi
20+
echo $SCHEMA_FILE
21+
generate-schema-doc --config no_link_to_reused_ref --config no_show_breadcrumbs --config no_collapse_long_descriptions --config deprecated_from_description --config title="$title" --config custom_template_path=$(pwd)'/templates/cyclonedx/base.html' --minify $SCHEMA_FILE 'docs/'$version'/index.html'
22+
sed -i -e "s/\${quotedTitle}/\"$title\"/g" 'docs/'$version'/index.html'
23+
sed -i -e "s/\${title}/$title/g" 'docs/'$version'/index.html'
24+
sed -i -e "s/\${version}/$version/g" 'docs/'$version'/index.html'
25+
}
26+
27+
generate 1.2
28+
generate 1.3
29+
generate 1.4
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{%- if type_name == "string" -%}
2+
{%- if schema.kw_min_length -%}
3+
{{ restriction("Must be at least <code>" ~ schema.kw_min_length.literal ~ "</code> characters long", "min-length", schema.kw_min_length.html_id) }}
4+
{%- endif -%}
5+
{%- if schema.kw_max_length -%}
6+
{{ restriction("Must be at most <code>" ~ schema.kw_max_length.literal ~ "</code> characters long", "max-length", schema.kw_max_length.html_id) }}
7+
{%- endif -%}
8+
{%- endif -%}
9+
{%- if type_name in ["integer", "number"] -%}
10+
{%- set restriction_text = (schema | get_numeric_restrictions_text("<code>", "</code>")) -%}
11+
{%- if restriction_text -%}
12+
{{ restriction(schema | get_numeric_restrictions_text("<code>", "</code>"), "numeric", schema.html_id ~ "_number") }}
13+
{%- endif -%}
14+
{%- endif -%}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{% from 'content.html' import content with context %}
2+
3+
<!DOCTYPE html>
4+
<html lang="en">
5+
<head>
6+
<title>${title}</title>
7+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
8+
<meta charset="UTF-8"/>
9+
<meta name="twitter:card" content="summary_large_image"/>
10+
<meta name="twitter:site" content="@CycloneDX_Spec"/>
11+
<meta name="twitter:title" content="${quotedTitle}"/>
12+
<meta name="twitter:image" content="https://cyclonedx.org/theme/assets/images/CycloneDX-Twitter-Card.png"/>
13+
<meta name="twitter:description" content="${quotedTitle}"/>
14+
<meta name="description" content="${quotedTitle}"/>
15+
<meta property="og:description" content="${quotedTitle}"/>
16+
<meta property="og:title" content="${quotedTitle}"/>
17+
<meta property="og:locale" content="en_US"/>
18+
<meta property="og:type" content="website" />
19+
<meta property="og:image" content="https://cyclonedx.org/theme/assets/images/CycloneDX-Twitter-Card.png" />
20+
<link rel="icon" href="https://cyclonedx.org/cyclonedx-icon.png" type="image/png"/>
21+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.0/css/bootstrap.min.css" integrity="sha512-P5MgMn1jBN01asBgU0z60Qk4QxiXo86+wlFahKrsQf37c9cro517WzVSPPV1tDKzhku2iJ2FVgL67wG03SGnNA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
22+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha512-SfTiTlX6kk+qitfevl/7LibUOeJWlt9rbyDn92a1DqWOw9vWG2MFoays0sgObmWazO5BQPiFucnnEAjpAB+/Sw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
23+
<link rel="stylesheet" type="text/css" href="schema_doc.css">
24+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.slim.js" integrity="sha512-HNbo1d4BaJjXh+/e6q4enTyezg5wiXvY3p/9Vzb20NIvkJghZxhzaXeffbdJuuZSxFhJP87ORPadwmU9aN3wSA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
25+
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.0/js/bootstrap.min.js" integrity="sha512-XKa9Hemdy1Ui3KSGgJdgMyYlUg1gM+QhL6cnlyTe2qzMCYm4nAZ1PsVerQzTTXzonUR+dmswHqgJPuwCq1MaAg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
26+
<script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/12.2.0/markdown-it.min.js" integrity="sha512-cTQeM/op796Fp1ZUxfech8gSMLT/HvrXMkRGdGZGQnbwuq/obG0UtcL04eByVa99qJik7WlnlQOr5/Fw5B36aw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
27+
<script src="schema_doc.min.js"></script>
28+
</head>
29+
<body class="blue" data-spy="scroll" data-target=".js-scrollspy" onload="anchorOnLoad();" id="root">
30+
31+
<nav class="navbar fixed-top navbar-expand-sm navbar-inverse">
32+
<a href="https://cyclonedx.org" class="navbar-brand site-header__logo"><img src="https://cyclonedx.org/theme/assets/images/layout/logo-white.svg" width="150"></img></a>
33+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarScroll" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">
34+
<span class="navbar-toggler-icon"></span>
35+
</button>
36+
<div class="collapse navbar-collapse" id="navbarScroll">
37+
<ul class="navbar-nav mr-auto my-2 my-lg-0 navbar-nav-scroll" style="max-height: 100px;">
38+
<li class="nav-item dropdown">
39+
<a class="nav-link dropdown-toggle" href="#" id="navbarScrollingDropdown" role="button" data-toggle="dropdown" aria-expanded="false">
40+
v${version} (JSON)
41+
</a>
42+
<ul class="dropdown-menu" aria-labelledby="navbarScrollingDropdown">
43+
<li><a class="dropdown-item" href="https://cyclonedx.org/docs/1.4/json/">v1.4 (JSON)</a></li>
44+
<li><a class="dropdown-item" href="https://cyclonedx.org/docs/1.3/json/">v1.3 (JSON)</a></li>
45+
<li><a class="dropdown-item" href="https://cyclonedx.org/docs/1.2/json/">v1.2 (JSON)</a></li>
46+
<li><hr class="dropdown-divider"/></li>
47+
<li><a class="dropdown-item" href="https://cyclonedx.org/docs/1.4/xml/">v1.4 (XML)</a></li>
48+
<li><a class="dropdown-item" href="https://cyclonedx.org/docs/1.3/xml/">v1.3 (XML)</a></li>
49+
<li><a class="dropdown-item" href="https://cyclonedx.org/docs/1.2/xml/">v1.2 (XML)</a></li>
50+
<li><a class="dropdown-item" href="https://cyclonedx.org/docs/1.1/xml/">v1.1 (XML)</a></li>
51+
<li><a class="dropdown-item" href="https://cyclonedx.org/docs/1.0/xml/">v1.0 (XML)</a></li>
52+
</ul>
53+
</li>
54+
</ul>
55+
</div>
56+
</nav>
57+
58+
59+
<div class="container-fluid" style="margin-top:70px; margin-bottom:3rem">
60+
<h1>${title}</h1>
61+
62+
{%- if title -%}
63+
<h1>{{ title }}</h1>
64+
{%- endif -%}
65+
{%- if config.expand_buttons -%}
66+
<div class="text-right">
67+
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target=".collapse:not(.show)" aria-expanded="false">Expand all</button>
68+
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target=".collapse.show" aria-expanded="false">Collapse all</button>
69+
</div>
70+
{%- endif -%}
71+
72+
{{ content(schema) }}
73+
74+
<footer class="site-footer__copyright fixed-bottom">
75+
<div class="container">
76+
<div class="row">
77+
<div class="col-sm-12">
78+
&copy; OWASP Foundation - CycloneDX is a <a href="https://owasp.org/cyclonedx">OWASP Flagship Project</a>
79+
</div>
80+
</div>
81+
</div>
82+
</footer>
83+
84+
</body>
85+
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<div class="breadcrumbs">
2+
{%- for node in schema.nodes_from_root -%}
3+
{%- if loop.first -%}
4+
root
5+
{%- else -%}
6+
<a href="#{{ node.html_id }}" onclick="anchorLink('{{ node.html_id }}')">{{ node.name_for_breadcrumbs }}</a>
7+
{%- endif -%}
8+
{%- if not loop.last %}
9+
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-arrow-right-short" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
10+
<path
11+
fill-rule="evenodd"
12+
d="M4 8a.5.5 0 0 1 .5-.5h5.793L8.146 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708-.708L10.293 8.5H4.5A.5.5 0 0 1 4 8z"
13+
/>
14+
</svg>
15+
{% endif -%}
16+
{%- endfor -%}
17+
</div>
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
{% from "macro_restriction.html" import restriction with context %}
2+
3+
{%- macro tabbed_section(operator, current_node) -%}
4+
{% include "tabbed_section.html" %}
5+
{%- endmacro -%}
6+
7+
{%- macro content(schema, skip_headers=False) -%}
8+
{% set keys = schema.keywords %}
9+
10+
{# Resolve type #}
11+
{%- set type_name = schema.type_name -%}
12+
13+
{% if not skip_headers %}
14+
{%- if config.show_breadcrumbs -%}
15+
{%- include "breadcrumbs.html" -%}
16+
{%- endif -%}
17+
18+
{# Display type #}
19+
{%- if not schema is combining -%}
20+
<span class="badge value-type">Type: {{ type_name }}</span>
21+
{%- endif -%}
22+
23+
{# Display default #}
24+
{%- set default_value = schema.default_value -%}
25+
{%- if default_value -%}
26+
{{ " " }}<span class="badge default-value">Default: {{ default_value }}</span>
27+
{%- endif -%}
28+
<br/>
29+
30+
{%- set description = (schema | get_description) -%}
31+
{%- include "section_description.html" -%}
32+
{%- endif -%}
33+
34+
35+
{%- if schema.should_be_a_link(config) -%}
36+
<a href="#{{ schema.links_to.html_id }}" onclick="anchorLink('{{ schema.links_to.html_id }}')" class="ref-link">Same definition as {{ schema.links_to.link_name }}</a>
37+
{%- elif schema.refers_to -%}
38+
{{ content(schema.refers_to_merged, True) }}
39+
{%- else -%}
40+
{# Handle having oneOf or allOf with only one condition #}
41+
{%- if schema.kw_all_of and (schema.kw_all_of.array_items | length) == 1 -%}
42+
{{ content(schema.kw_all_of.array_items[0]) }}
43+
{%- elif schema.kw_any_of and (schema.kw_any_of.array_items | length) == 1 -%}
44+
{{ content(schema.kw_any_of.array_items[0]) }}
45+
{%- else -%}
46+
{%- if schema.explicit_no_additional_properties -%}
47+
{{ " " }}<span class="badge no-additional">No Additional Properties</span>
48+
{%- endif -%}
49+
50+
{# Combining: allOf, anyOf, oneOf, not #}
51+
{%- if schema.kw_all_of -%}
52+
<div class="all-of-value" id="{{ schema.kw_all_of.html_id }}">{{ tabbed_section("allOf", schema.kw_all_of) }}</div>
53+
{%- endif -%}
54+
{%- if schema.kw_any_of -%}
55+
<div class="any-of-value" id="{{ schema.kw_any_of.html_id }}">{{ tabbed_section("anyOf", schema.kw_any_of) }}</div>
56+
{%- endif -%}
57+
{%- if schema.kw_one_of -%}
58+
<div class="one-of-value" id="{{ schema.kw_one_of.html_id }}">{{ tabbed_section("oneOf", schema.kw_one_of) }}</div>
59+
{%- endif -%}
60+
{%- if schema.kw_not -%}
61+
{% include "section_not.html" %}
62+
{%- endif -%}
63+
64+
{# Enum and const #}
65+
{%- if schema.kw_enum -%}
66+
<div class="enum-value" id="{{ schema.kw_enum.html_id }}">
67+
<h4>Must be one of:</h4>
68+
<ul class="list-group">
69+
{%- for enum_choice in schema.kw_enum.array_items -%}
70+
<li class="list-group-item enum-item">{{ enum_choice.literal | python_to_json }}</li>
71+
{%- endfor -%}
72+
</ul>
73+
</div>
74+
{%- endif -%}
75+
{%- if schema.kw_const -%}
76+
<span class="const-value" id="{{ schema.kw_const.html_id }}">Specific value: <code>{{ schema.kw_const.raw | python_to_json }}</code></span>
77+
{%- endif -%}
78+
79+
{# Pattern (Regular Expression) #}
80+
{%- if schema.kw_pattern -%}
81+
<span class="pattern-value" id="{{ schema.kw_pattern.html_id }}">Must match regular expression: <code>{{ schema.kw_pattern.literal | escape }}</code></span>
82+
{%- endif -%}
83+
84+
{# Conditional subschema, or if-then-else section #}
85+
{%- if schema.has_conditional -%}
86+
{% include "section_conditional_subschema.html" %}
87+
{%- endif -%}
88+
89+
{# Required properties that are not defined under "properties". They will only be listed #}
90+
{% include "section_undocumented_required_properties.html" %}
91+
92+
{# Show the requested type(s) #}
93+
{% include "badge_type.html" %}
94+
95+
{# Show array restrictions #}
96+
{%- if type_name.startswith("array") -%}
97+
{% include "section_array.html" %}
98+
{%- endif -%}
99+
100+
{# Display examples #}
101+
{%- set examples = schema.examples -%}
102+
{%- if examples -%}
103+
{% include "section_examples.html" %}
104+
{%- endif -%}
105+
106+
{# Properties, pattern properties, additional properties #}
107+
{%- for sub_property in schema.iterate_properties -%}
108+
{# Custom modification to remove $ properties from documentation #}
109+
{%- if not sub_property.property_display_name.startswith("$") -%}
110+
{% include "section_properties.html" %}
111+
{%- endif -%}
112+
{%- endfor -%}
113+
114+
{%- endif -%}
115+
{%- endif -%}
116+
{%- endmacro -%}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{%- macro restriction(inner_text, css_class_name, html_id) -%}
2+
<p><span class="badge badge-light restriction {{ css_class_name }}-restriction" id="{{ html_id }}">{{ inner_text }}</span></p>
3+
{%- endmacro -%}

0 commit comments

Comments
 (0)