Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
  • Loading branch information
jkowalleck committed Apr 9, 2024
1 parent b4a133a commit 42c6f25
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
4 changes: 3 additions & 1 deletion cyclonedx/schema/_res/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ some schema for offline use as download via [script](../../../tools/schema-downl
original sources: <https://github.com/CycloneDX/specification/tree/master/schema>

Currently using version
[299209abd9531d808e0cc4235e77a7c4b1b53d96](https://github.com/CycloneDX/specification/commit/299209abd9531d808e0cc4235e77a7c4b1b53d96)
[55343ba19dee1785acf1ce9191540d5fd7b590db](https://github.com/CycloneDX/specification/commit/55343ba19dee1785acf1ce9191540d5fd7b590db)

| file | note |
|------|------|
Expand All @@ -14,10 +14,12 @@ Currently using version
| [`bom-1.3.SNAPSHOT.xsd`](bom-1.3.SNAPSHOT.xsd) | applied changes: 1 |
| [`bom-1.4.SNAPSHOT.xsd`](bom-1.4.SNAPSHOT.xsd) | applied changes: 1 |
| [`bom-1.5.SNAPSHOT.xsd`](bom-1.5.SNAPSHOT.xsd) | applied changes: 1 |
| [`bom-1.6.SNAPSHOT.xsd`](bom-1.6.SNAPSHOT.xsd) | applied changes: 1 |
| [`bom-1.2.SNAPSHOT.schema.json`](bom-1.2.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`bom-1.3.SNAPSHOT.schema.json`](bom-1.3.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`bom-1.4.SNAPSHOT.schema.json`](bom-1.4.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`bom-1.5.SNAPSHOT.schema.json`](bom-1.5.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`bom-1.6.SNAPSHOT.schema.json`](bom-1.6.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`bom-1.2-strict.SNAPSHOT.schema.json`](bom-1.2-strict.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`bom-1.3-strict.SNAPSHOT.schema.json`](bom-1.3-strict.SNAPSHOT.schema.json) | applied changes: 2,3,4,5 |
| [`spdx.SNAPSHOT.xsd`](spdx.SNAPSHOT.xsd) | |
Expand Down
10 changes: 5 additions & 5 deletions examples/complex_deserialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
# region JSON

json_data = """{
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
"$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"specVersion": "1.6",
"serialNumber": "urn:uuid:88fabcfa-7529-4ba2-8256-29bec0c03900",
"version": 1,
"metadata": {
Expand Down Expand Up @@ -145,7 +145,7 @@
}
]
}"""
my_json_validator = JsonStrictValidator(SchemaVersion.V1_5)
my_json_validator = JsonStrictValidator(SchemaVersion.V1_6)
try:
validation_errors = my_json_validator.validate_str(json_data)
if validation_errors:
Expand All @@ -165,7 +165,7 @@
# endregion XML

xml_data = """<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.5"
<bom xmlns="http://cyclonedx.org/schema/bom/1.6"
serialNumber="urn:uuid:88fabcfa-7529-4ba2-8256-29bec0c03900"
version="1"
>
Expand Down Expand Up @@ -246,7 +246,7 @@
</dependency>
</dependencies>
</bom>"""
my_xml_validator: 'XmlValidator' = make_schemabased_validator(OutputFormat.XML, SchemaVersion.V1_5)
my_xml_validator: 'XmlValidator' = make_schemabased_validator(OutputFormat.XML, SchemaVersion.V1_6)
try:
validation_errors = my_xml_validator.validate_str(xml_data)
if validation_errors:
Expand Down
4 changes: 2 additions & 2 deletions examples/complex_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
my_json_outputter: 'JsonOutputter' = JsonV1Dot5(bom)
serialized_json = my_json_outputter.output_as_string(indent=2)
print(serialized_json)
my_json_validator = JsonStrictValidator(SchemaVersion.V1_5)
my_json_validator = JsonStrictValidator(SchemaVersion.V1_6)
try:
validation_errors = my_json_validator.validate_str(serialized_json)
if validation_errors:
Expand All @@ -99,7 +99,7 @@
# region XML
"""demo with implicit instructions for SchemaVersion, outputter and validator. TypeCheckers will catch errors."""

my_xml_outputter: 'XmlOutputter' = make_outputter(bom, OutputFormat.XML, SchemaVersion.V1_5)
my_xml_outputter: 'XmlOutputter' = make_outputter(bom, OutputFormat.XML, SchemaVersion.V1_6)
serialized_xml = my_xml_outputter.output_as_string(indent=2)
print(serialized_xml)
my_xml_validator: 'XmlValidator' = make_schemabased_validator(
Expand Down
16 changes: 9 additions & 7 deletions tests/test_schema_SchemaVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@

from cyclonedx.schema import SchemaVersion

SORTED_SV = (SchemaVersion.V1_6,
SchemaVersion.V1_5,
SchemaVersion.V1_4,
SchemaVersion.V1_3,
SchemaVersion.V1_2,
SchemaVersion.V1_1,
SchemaVersion.V1_0)
SORTED_SV = (
SchemaVersion.V1_6,
SchemaVersion.V1_5,
SchemaVersion.V1_4,
SchemaVersion.V1_3,
SchemaVersion.V1_2,
SchemaVersion.V1_1,
SchemaVersion.V1_0
)

# do not use any value-comparisons or implicit hash-functions here !
# just work with the position in tuple SORTED_SCHEMA_VERSIONS
Expand Down

0 comments on commit 42c6f25

Please sign in to comment.