Skip to content

Commit 026b84c

Browse files
committed
Namespace ABNF
- addresses review comments of #882 - update a few examples - corrected "model" to "collection"
1 parent 6a0bc7e commit 026b84c

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

docs/reference/code/namespaces.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ we expect that this will rarely lead to conflicts in practice.
161161
where a unregistered namespace is needed.
162162
The namespace `x_example.test#test` is recommended for use in testing of current or
163163
new SSVC related code.
164+
The namespace `x_example.test#documentation` is recommended for use in documentation
165+
or as examples.
164166

165167
!!! tip "Test Namespace"
166168

@@ -222,8 +224,8 @@ Subsequently, a `$` followed by a valid BCP 47 language tag ends the string.
222224
Note: If the `translation` uses just the reverse domain name followed by the language tag,
223225
e.g. `.example.test$de-DE`, this implies an unofficial translation done by the entity in possession of that
224226
domain name.
225-
A `translation` using an `x-name` indicates that the extension bases of a model that had a different language
226-
and no formal translation was used to develop that model.
227+
A `translation` using an `x-name` indicates that the extension bases of a collection that had a different language
228+
and no formal translation was used to develop that collection.
227229
The following diagram illustrates the structure of namespace extensions:
228230

229231
```mermaid
@@ -314,7 +316,7 @@ base_ns -->|/| first
314316

315317
It is also different from `ssvc//.example.isao$pl-PL/example.isao#constituency` which
316318
denotes that the ISAO did a translation of the `ssvc` namespace to Polish and based
317-
the model for their constituency on that translation.
319+
the collection for their constituency on that translation.
318320

319321
!!! example "Refinement of Concepts for a Specific Constituency"
320322

src/ssvc/namespaces.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class NameSpace(StrEnum):
5858
CVSS = auto()
5959
CISA = auto()
6060
BASIC = auto()
61+
EXAMPLE = auto()
62+
TEST = auto()
6163

6264
@classmethod
6365
def validate(cls, value: str) -> str:

src/ssvc/utils/field_specs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
examples=[
4848
"ssvc",
4949
"cisa",
50-
"x_example.test#test//.example.test#test",
50+
"x_example.test#test//.example.test#private-extension",
5151
"ssvc/de-DE/.example.organization#reference-arch-1",
5252
],
5353
pattern=NS_PATTERN,

src/test/test_namespaces_pattern.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ def setUp(self):
5454
"x_example.test.test#test/pl-PL/.example.test#another-collection/.org.example#a-different-collection/en-CA-newfound", # valid BCP-47 tag and multiple segments
5555
"example.test", # valid namespace with dots following reverse domain notation
5656
"x_example.test#test", # valid namespace with x_ prefix and dots following reverse domain notation
57-
"aa.example", # valid namespace with dots following reverse domain notation for 2-letter TLD based on private use of ISO-3166
58-
"x_au.com.example#bar" # valid namespace with x_ prefix and dots following reverse domain notation
59-
"abc//.example.test#test",
60-
"abc//.com.au.example#test",
61-
"abc//.example.test#test/.example.test#test",
57+
"aa.example", # valid namespace with dots following reverse domain notation for 2-letter TLD based on private use of ISO-3166
58+
"x_aa.example#test" # valid namespace with x_ prefix and dots following reverse domain notation
59+
"test//.example.test#test",
60+
"test//.com.au.example#test",
61+
"example//.example.test#test/.example.some-other-org#foo",
6262
"foo.bar//.baz.quux#foo",
6363
]
6464
self.expect_fail = [
@@ -67,6 +67,7 @@ def setUp(self):
6767
"x__invalid", # invalid namespace, double underscore
6868
"x_-invalid", # invalid namespace, dash after x_
6969
"x_.invalid", # invalid namespace, dash at end
70+
"x_invalid-", # invalid namespace, dash at end
7071
"x_/foo", # invalid namespace, slash after x_, invalid BCP-47 tag
7172
"x_//foo", # invalid namespace, double slash after x_
7273
"x_abc/invalid-bcp-47", # not a valid BCP-47 tag
@@ -104,7 +105,7 @@ def test_base_pattern(self):
104105
"contains-dash",
105106
"contains-dash-and.dot",
106107
"com.example", # valid namespace with dots following reverse domain notation
107-
"au.com.example", # valid namespace with dots following reverse domain notation
108+
"aa.com.example", # valid namespace with dots following reverse domain notation
108109
]
109110
x_fail = [
110111
"a", # too short
@@ -137,7 +138,8 @@ def test_base_ns_pattern(self):
137138
"9abc", # starts with a number
138139
"x__invalid", # double underscore
139140
"x_-invalid", # dash after x_
140-
"x_.invalid", # dash at end
141+
"x_.invalid", # dot at start
142+
"x_invalid-", # dash at end
141143
"x_9abc", # starts with a number after x_
142144
"x_abc.", # ends with a dot
143145
"x_abc-", # ends with a dash

0 commit comments

Comments
 (0)