Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
574f4c8
add new TestNamespacePattern from #858
bernhardreiter Aug 15, 2025
9eb9de6
add new ssvc namspace pattern based on ABNF
bernhardreiter Aug 15, 2025
72e7f32
cleanup whitespace in ssvc_namespace_pattern.abnf
bernhardreiter Aug 15, 2025
f81c23a
adapt namespace tests to new patterns from #858
bernhardreiter Aug 15, 2025
4824e20
cleanup codestyle with black (minor)
bernhardreiter Aug 15, 2025
6a53385
put freshly generated schema files in
bernhardreiter Aug 15, 2025
9bc7850
make namespace abnf and examples more consistent
bernhardreiter Aug 18, 2025
57b7201
improve x_com_yahooinc namespace model example
bernhardreiter Aug 18, 2025
b33d2e0
improving namespace example
bernhardreiter Aug 18, 2025
80ab7f1
fix example x_name-space
bernhardreiter Aug 18, 2025
b091c8f
Merge branch 'main' into namespacepattern
tschmidtb51 Aug 19, 2025
4707b60
Namespace ABNF
tschmidtb51 Aug 19, 2025
6a7be17
Namespace ABNF
tschmidtb51 Aug 19, 2025
86b62f4
improve ssvc_namespace_pattern.abnf (minor)
bernhardreiter Aug 19, 2025
df2d494
Update src/ssvc/utils/ssvc_namespace_pattern.abnf
bernhardreiter Aug 19, 2025
52e921f
Update src/ssvc/utils/ssvc_namespace_pattern.abnf
bernhardreiter Aug 19, 2025
43e7496
Update src/ssvc/utils/ssvc_namespace_pattern.abnf
bernhardreiter Aug 19, 2025
48d0835
Update src/ssvc/utils/ssvc_namespace_pattern.abnf
bernhardreiter Aug 19, 2025
77be009
Update src/test/test_mixins.py
bernhardreiter Aug 19, 2025
2f34378
improve test_namespaces.py
bernhardreiter Aug 19, 2025
d5fee73
Merge remote-tracking branch 'refs/remotes/origin/namespacepattern' i…
bernhardreiter Aug 19, 2025
47191aa
Fix ssvc/utils/patterns.py by anchoring NS_PATTERN
bernhardreiter Aug 19, 2025
0dd4e93
cleanup tailing whitespace for ssvc_namespace_pattern.abnf
bernhardreiter Aug 19, 2025
975a4b9
change to updated json schema files
bernhardreiter Aug 19, 2025
1ba6510
Update src/test/test_namespaces.py
bernhardreiter Aug 19, 2025
4108860
Update src/test/test_namespaces_pattern.py
bernhardreiter Aug 19, 2025
72c3f7e
fix typo in comment of test_namespaces_pattern.py
bernhardreiter Aug 19, 2025
24713a0
Update src/test/test_namespaces_pattern.py
bernhardreiter Aug 19, 2025
1c199b4
change test case for namespace
bernhardreiter Aug 19, 2025
27b468c
add test if NS_PATTERN is anchored
bernhardreiter Aug 19, 2025
ed27a96
Update src/test/test_namespaces_pattern.py
bernhardreiter Aug 19, 2025
74f5456
Update src/test/test_namespaces_pattern.py
bernhardreiter Aug 19, 2025
6a0bc7e
adjust documentation for new namespace rules
bernhardreiter Aug 19, 2025
026b84c
Namespace ABNF
tschmidtb51 Aug 19, 2025
b81144f
fix relative link in namespaces.md documentation
bernhardreiter Aug 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ssvc/decision_tables/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ def main() -> None:
table = DecisionTable(
name="Test Table",
description="A test decision table",
namespace="x_com.example#test-table",
namespace="x_example.test#test-table",
decision_points=dpg.decision_points,
outcome=outcomes.id,
)
Expand Down
4 changes: 2 additions & 2 deletions src/ssvc/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ class SelectionList(_Timestamped, BaseModel):
"summary": "JSON representation of decision point 2",
},
{
"uri": "https://example.com/ssvc/x_com.example/decision_points.json",
"summary": "A JSON file containing extension decision points in the x_com.example namespace",
"uri": "https://test.example/ssvc/x_example.test#test/decision_points.json",
"summary": "A JSON file containing extension decision points in the x_example.test#test namespace",
},
],
],
Expand Down
4 changes: 2 additions & 2 deletions src/ssvc/utils/field_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
examples=[
"ssvc",
"cisa",
"x_com.example//com.example#private",
"ssvc/de-DE/example.organization#reference-arch-1",
"x_example.test#test//.example.test#test",
"ssvc/de-DE/.example.organization#reference-arch-1",
],
pattern=NS_PATTERN,
min_length=MIN_NS_LENGTH,
Expand Down
2 changes: 1 addition & 1 deletion src/test/decision_points/test_dp_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_registry(self):
key="asdfasdf",
description="asdfasdf",
version="1.33.1",
namespace="x_com.example#foo",
namespace="x_example.test#test",
values=tuple(self.values),
)

Expand Down
14 changes: 7 additions & 7 deletions src/test/decision_tables/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ def setUp(self):
name="dp1",
description="description for dp1",
version="1.0.0",
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="dp1",
values=(self.dp1v1, self.dp1v2),
)
self.dp2 = DecisionPoint(
name="dp2",
description="description for dp2",
version="1.0.0",
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="dp2",
values=(self.dp2v1, self.dp2v2, self.dp2v3, self.dp2v4),
)
Expand All @@ -94,7 +94,7 @@ def setUp(self):
name="outcome",
description="description for outcome",
version="1.0.0",
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="outcome",
values=(self.ogv1, self.ogv2, self.ogv3),
)
Expand All @@ -104,7 +104,7 @@ def setUp(self):

self.dt = DecisionTable(
key="TEST",
namespace="x_com.example#foo",
namespace="x_example.test#test",
name="Test Table",
description="Describes the test table",
decision_points=self.dpdict,
Expand Down Expand Up @@ -357,13 +357,13 @@ def test_single_dp_dt(self):
name="dp_in",
description="A single decision point",
version="1.0.0",
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="dp",
values=(self.dp1v1, self.dp1v2),
registered=False,
)
dp_out = DecisionPoint(
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="outcome",
name="Outcome",
description="Outcome for single DP test",
Expand All @@ -374,7 +374,7 @@ def test_single_dp_dt(self):

single_dt = DecisionTable(
key="SINGLE_TEST",
namespace="x_com.example#foo",
namespace="x_example.test#test",
name="Single DP Test Table",
description="Describes the single DP test table",
decision_points={dp.id: dp for dp in [dp_in, dp_out]},
Expand Down
28 changes: 14 additions & 14 deletions src/test/registry/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Dummy:
obj = DecisionPoint(
name="TestDP",
description="A test decision point",
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="TEST",
values=[
DecisionPointValue(
Expand All @@ -92,7 +92,7 @@ class DpSubclass(DecisionPoint):
obj2 = DpSubclass(
name="TestDP2",
description="Another test decision point",
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="TEST2",
values=[
DecisionPointValue(
Expand All @@ -115,7 +115,7 @@ def test_valued_version(self):
dp = DecisionPoint(
name="TestDP",
description="A test decision point",
namespace="x_com.example#foo",
namespace="x_example.test#test",
version="2.0.0",
key="TEST",
values=[
Expand All @@ -138,7 +138,7 @@ def test_nonvalued_version(self):
# test with a known type

dp1 = DecisionPoint(
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="TEST",
version="2.0.0",
name="TestDP",
Expand All @@ -163,7 +163,7 @@ def test_nonvalued_version(self):
registered=False,
)
dp2 = DecisionPoint(
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="TEST2",
version="2.0.0",
name="TestDP",
Expand All @@ -183,7 +183,7 @@ def test_nonvalued_version(self):
)

dp3 = DecisionPoint(
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="TEST3",
version="2.0.0",
name="TestDP2",
Expand All @@ -196,7 +196,7 @@ def test_nonvalued_version(self):
)

dt = DecisionTable(
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="TEST_DT",
version="2.0.0",
name="TestDT",
Expand Down Expand Up @@ -224,7 +224,7 @@ def test_key(self, mock_valued_version, mock_nonvalued_version):
mockobj1 = Mock()
mockobj1.schemaVersion = "2.0.0"
mockobj1.key = "TEST"
mockobj1.namespace = "x_com.example#foo"
mockobj1.namespace = "x_example.test#test"
mockobj1.version = "1.0.0"
mockobj1.name = "Test Object"
mockobj1.description = "A test object"
Expand All @@ -238,7 +238,7 @@ def test_key(self, mock_valued_version, mock_nonvalued_version):
mockobj2.schemaVersion = "2.0.0"
mockobj2.key = "TEST2"
mockobj2.version = "2.0.0"
mockobj2.namespace = "x_com.example#foo"
mockobj2.namespace = "x_example.test#test"
mockobj2.name = "Test Object"
mockobj2.description = "A test object"
mockobj2.id = "test-id"
Expand Down Expand Up @@ -269,7 +269,7 @@ def test__insert(self):
dp = DecisionPoint(
name="TestDP",
description="A test decision point",
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="TEST",
values=[
DecisionPointValue(
Expand Down Expand Up @@ -303,7 +303,7 @@ def test__compare(self):
dp1 = DecisionPoint(
name="TestDP",
description="A test decision point",
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="TEST",
values=[
DecisionPointValue(
Expand All @@ -319,7 +319,7 @@ def test__compare(self):
dp2 = DecisionPoint(
name="TestDP2",
description="A test decision point",
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="TEST",
values=[
DecisionPointValue(
Expand Down Expand Up @@ -357,7 +357,7 @@ def test_lookup_latest(self):
dp = DecisionPoint(
name="TestDP",
description="A test decision point",
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="TEST",
version=version,
values=[
Expand Down Expand Up @@ -385,7 +385,7 @@ def test_lookup_latest(self):

latest = base.lookup_latest(
objtype="DecisionPoint",
namespace="x_com.example#foo",
namespace="x_example.test#test",
key="TEST",
registry=self.registry,
)
Expand Down
30 changes: 15 additions & 15 deletions src/test/test_namespaces_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ def setUp(self):
"cisa",
"custom", # not in enum, but valid for the pattern
"abc", # not in enum, but valid for the pattern
"x_com.example#foo/",
"x_com.example#foo//.org.example#bar",
"x_example.test#test/",
"x_example.test#test//.org.example#bar",
"ssvc/de-DE/.org.example#reference-arch-1", # valid BCP-47 tag, reverse domain notation, hash
"ssvc//.de.bund.bsi$de-DE", # BSI's translation of SSVC
"ssvc//.de.bund.bsi#ref-arch-1/de-DE", # BSI's official translation to German as used in Germany of its ref-arch-1 model which is originally written in English
"ssvc//.de.bund.bsi#ref-arch-2$de-DE", # BSI's ref-arch-2 model which is originally written in German
"ssvc//.de.bund.bsi#ref-arch-2$de-DE/en-GB", # BSI's official translation to English as used in GB of its ref-arch-2 model which is originally written in German
"ssvc//.example.organization#model/.com.example#foo", # empty BCP-47 tag, two segments with one hash each
"ssvc//.example.organization#model/.example.test#test", # empty BCP-47 tag, two segments with one hash each
"nist#800-30", # NIST's registered model regarding its publication 800-30
"x_gov.nist#800-30/de-DE", # NIST's official translation to German as used in Germany of its model (regarding its publication) 800-30
"x_gov.nist#800-30//.de.bund.bsi$de-DE", # BSI's translation to German as used in Germany of NIST's model (regarding its publication) 800-30
"x_com.example.test#bar/pl-PL/.com.example#foo/.org.example#bar/newfound", # valid BCP-47 tag and multiple segments
"com.example", # valid namespace with dots following reverse domain notation
"x_com.example#foo", # valid namespace with x_ prefix and dots following reverse domain notation
"x_example.test.test#test/pl-PL/.example.test#test/.example.test#test/newfound", # valid BCP-47 tag and multiple segments
"example.test", # valid namespace with dots following reverse domain notation
"x_example.test#test", # valid namespace with x_ prefix and dots following reverse domain notation
"au.com.example", # valid namespace with dots following reverse domain notation for 2-letter TLD
"x_au.com.example#bar" # valid namespace with x_ prefix and dots following reverse domain notation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

"abc//.com.example#foo",
"abc//.com.au.example#foo",
"abc//.com.example#foo/.foo.bar#bar",
"abc//.example.test#test",
"abc//.com.au.example#test",
"abc//.example.test#test/.example.test#test",
"foo.bar//.baz.quux#foo",
]
self.expect_fail = [
Expand Down Expand Up @@ -110,9 +110,9 @@ def test_base_pattern(self):
"a", # too short
"9abc", # starts with a number
"x_foo", # no x_ in base pattern
"com.example#foo", # no hashes in base
"com.example##foo", # double hash
"com.example#foo#bar", # multiple hashes not allowed
"example.test#test", # no hashes in base
"example.test##test", # double hash
"example.test.test#test#test", # multiple hashes not allowed
"contains..double.dot", # double dot
"contains--double-dash", # double dash
"contains_underscore", # underscore not allowed
Expand All @@ -131,7 +131,7 @@ def test_base_ns_pattern(self):
x_success = [
"abc",
"abc-with-dashes", # dashes are allowed in the base pattern
"x_example.com#foo",
"x_example.test#test",
]
x_fail = [
"9abc", # starts with a number
Expand Down Expand Up @@ -209,8 +209,8 @@ def test_ext_segment_pattern(self):
"invalid.segment.", # ends with a dot
"invalid.segment-", # ends with a dash
"invalid/segment", # slash not allowed
"com.example##foo", # hashes not allows
"com.example#foo", # hashes not allows
"example.test##test", # hashes not allowed
"example.test#test", # hashes not allowed
"invalid#segment#with#multiple#hashes", # multiple hashes not allowed
"invalid/segment/", # ends with a slash
]
Expand Down
4 changes: 2 additions & 2 deletions src/test/utils/test_toposort.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def setUp(self):
from ssvc.decision_points.base import DecisionPoint, DecisionPointValue

self.dp1 = DecisionPoint(
namespace="x_com.example#foo",
namespace="x_example.test#test",
name="Decision Point 1",
key="DP1",
version="1.0.0",
Expand All @@ -87,7 +87,7 @@ def setUp(self):
],
)
self.dp2 = DecisionPoint(
namespace="x_com.example#foo",
namespace="x_example.test#test",
name="Decision Point 2",
key="DP2",
version="1.0.0",
Expand Down