colregs 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/data/applicability.json +219 -244
- package/data/facts.json +4 -4
- package/data/geometry.json +8 -8
- package/data/i18n/en.json +27 -0
- package/data/i18n/fi.json +25 -0
- package/data/images.json +32 -32
- package/data/operations.json +79 -0
- package/data/rules.json +5 -0
- package/data/version.json +1 -1
- package/docs/adr/0006-json-schema-and-identifier-diff.md +2 -0
- package/docs/adr/0011-api-shape.md +1 -1
- package/docs/adr/0014-engine-interface-owned-by-colregs.md +103 -0
- package/docs/adr/0015-rule-ids-are-paragraph-keys.md +191 -0
- package/docs/budgets.json +5 -15
- package/docs/identifiers.md +49 -51
- package/docs/maritime-sources.md +58 -0
- package/docs/normative-language.md +103 -0
- package/docs/part-b-invariants.md +31 -29
- package/docs/requirements.md +80 -71
- package/fixtures/applicability-fixtures.json +190 -190
- package/fixtures/situation-fixtures.json +287 -287
- package/package.json +1 -1
- package/schema/applicability-fixtures.schema.json +4 -13
- package/schema/applicability.schema.json +27 -27
- package/schema/conduct-evaluation.schema.json +135 -0
- package/schema/display-evaluation.schema.json +146 -0
- package/schema/encounter-evaluation.schema.json +109 -0
- package/schema/evaluation.schema.json +149 -0
- package/schema/fact-record.schema.json +30 -0
- package/schema/i18n-catalog.schema.json +47 -0
- package/schema/operations.schema.json +124 -0
- package/schema/rule2-departure-finding.schema.json +72 -0
- package/schema/rule2-departure-model.schema.json +159 -0
- package/schema/situation-fixtures.schema.json +10 -146
- package/schema/situation.schema.json +72 -0
- package/schema/trace.schema.json +33 -0
- package/data/deprecated-identifiers.json +0 -7
- package/schema/deprecated-identifiers.schema.json +0 -29
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://github.com/mark-brannan/colregs/schema/situation-fixtures.schema.json",
|
|
4
4
|
"title": "fixtures/situation-fixtures.json",
|
|
5
|
-
"description": "Two-subject situation fixtures (ADR 0005, REQ-CAT-5). Structure only -- see docs/adr/0006-json-schema-and-identifier-diff.md.
|
|
5
|
+
"description": "Two-subject situation fixtures (ADR 0005, REQ-CAT-5). Structure only -- see docs/adr/0006-json-schema-and-identifier-diff.md. A case's situation is schema/situation.schema.json; namespace resolution (every kin:/geo:/hist: key declared in facts.json) stays in the tests.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"required": [
|
|
@@ -12,26 +12,16 @@
|
|
|
12
12
|
"cases"
|
|
13
13
|
],
|
|
14
14
|
"$defs": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"pattern": "^[0-9]+[a-z0-9]*(-[a-z0-9]+)*$"
|
|
15
|
+
"ruleId": {
|
|
16
|
+
"$ref": "applicability.schema.json#/$defs/ruleId"
|
|
18
17
|
},
|
|
19
18
|
"modality": {
|
|
20
|
-
"
|
|
21
|
-
"enum": [
|
|
22
|
-
"shall",
|
|
23
|
-
"may",
|
|
24
|
-
"shall-if-practicable",
|
|
25
|
-
"conditional",
|
|
26
|
-
"exempt",
|
|
27
|
-
"shall-not",
|
|
28
|
-
"shall-not-impede"
|
|
29
|
-
]
|
|
19
|
+
"$ref": "applicability.schema.json#/$defs/modality"
|
|
30
20
|
},
|
|
31
21
|
"expectItem": {
|
|
32
22
|
"oneOf": [
|
|
33
23
|
{
|
|
34
|
-
"$ref": "#/$defs/
|
|
24
|
+
"$ref": "#/$defs/ruleId"
|
|
35
25
|
},
|
|
36
26
|
{
|
|
37
27
|
"type": "object",
|
|
@@ -42,7 +32,7 @@
|
|
|
42
32
|
],
|
|
43
33
|
"properties": {
|
|
44
34
|
"entry": {
|
|
45
|
-
"$ref": "#/$defs/
|
|
35
|
+
"$ref": "#/$defs/ruleId"
|
|
46
36
|
},
|
|
47
37
|
"modality": {
|
|
48
38
|
"$ref": "#/$defs/modality"
|
|
@@ -50,109 +40,6 @@
|
|
|
50
40
|
}
|
|
51
41
|
}
|
|
52
42
|
]
|
|
53
|
-
},
|
|
54
|
-
"scalar": {
|
|
55
|
-
"oneOf": [
|
|
56
|
-
{
|
|
57
|
-
"type": "string",
|
|
58
|
-
"pattern": "^[a-z][a-z0-9_]*:[a-z0-9_]+$"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"type": "number"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"type": "boolean"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"type": "null"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"type": "object",
|
|
71
|
-
"additionalProperties": false,
|
|
72
|
-
"required": [
|
|
73
|
-
"latitude",
|
|
74
|
-
"longitude"
|
|
75
|
-
],
|
|
76
|
-
"properties": {
|
|
77
|
-
"latitude": {
|
|
78
|
-
"type": "number",
|
|
79
|
-
"minimum": -90,
|
|
80
|
-
"maximum": 90
|
|
81
|
-
},
|
|
82
|
-
"longitude": {
|
|
83
|
-
"type": "number",
|
|
84
|
-
"minimum": -180,
|
|
85
|
-
"maximum": 180
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
},
|
|
91
|
-
"factRecord": {
|
|
92
|
-
"type": "object",
|
|
93
|
-
"additionalProperties": false,
|
|
94
|
-
"patternProperties": {
|
|
95
|
-
"^fact:[a-z0-9_]+$": {
|
|
96
|
-
"$ref": "#/$defs/scalar"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
"kinRecord": {
|
|
101
|
-
"type": "object",
|
|
102
|
-
"additionalProperties": false,
|
|
103
|
-
"patternProperties": {
|
|
104
|
-
"^kin:[a-z0-9_]+$": {
|
|
105
|
-
"$ref": "#/$defs/scalar"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
"geoRecord": {
|
|
110
|
-
"type": "object",
|
|
111
|
-
"additionalProperties": false,
|
|
112
|
-
"patternProperties": {
|
|
113
|
-
"^geo:[a-z0-9_]+$": {
|
|
114
|
-
"$ref": "#/$defs/scalar"
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
"histRecord": {
|
|
119
|
-
"type": "object",
|
|
120
|
-
"additionalProperties": false,
|
|
121
|
-
"patternProperties": {
|
|
122
|
-
"^hist:[a-z0-9_]+$": {
|
|
123
|
-
"$ref": "#/$defs/scalar"
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
"envRecord": {
|
|
128
|
-
"type": "object",
|
|
129
|
-
"additionalProperties": false,
|
|
130
|
-
"patternProperties": {
|
|
131
|
-
"^env:[a-z0-9_]+$": {
|
|
132
|
-
"$ref": "#/$defs/scalar"
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
"vessel": {
|
|
137
|
-
"type": "object",
|
|
138
|
-
"additionalProperties": false,
|
|
139
|
-
"required": [
|
|
140
|
-
"fact"
|
|
141
|
-
],
|
|
142
|
-
"properties": {
|
|
143
|
-
"fact": {
|
|
144
|
-
"$ref": "#/$defs/factRecord"
|
|
145
|
-
},
|
|
146
|
-
"kin": {
|
|
147
|
-
"$ref": "#/$defs/kinRecord"
|
|
148
|
-
},
|
|
149
|
-
"geo": {
|
|
150
|
-
"$ref": "#/$defs/geoRecord"
|
|
151
|
-
},
|
|
152
|
-
"hist": {
|
|
153
|
-
"$ref": "#/$defs/histRecord"
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
43
|
}
|
|
157
44
|
},
|
|
158
45
|
"properties": {
|
|
@@ -200,7 +87,7 @@
|
|
|
200
87
|
"type": "string"
|
|
201
88
|
},
|
|
202
89
|
"bare": {
|
|
203
|
-
"$ref": "#/$defs/
|
|
90
|
+
"$ref": "#/$defs/ruleId"
|
|
204
91
|
},
|
|
205
92
|
"with_modality": {
|
|
206
93
|
"type": "object",
|
|
@@ -211,7 +98,7 @@
|
|
|
211
98
|
],
|
|
212
99
|
"properties": {
|
|
213
100
|
"entry": {
|
|
214
|
-
"$ref": "#/$defs/
|
|
101
|
+
"$ref": "#/$defs/ruleId"
|
|
215
102
|
},
|
|
216
103
|
"modality": {
|
|
217
104
|
"$ref": "#/$defs/modality"
|
|
@@ -286,31 +173,8 @@
|
|
|
286
173
|
}
|
|
287
174
|
},
|
|
288
175
|
"situation": {
|
|
289
|
-
"
|
|
290
|
-
"
|
|
291
|
-
"required": [
|
|
292
|
-
"own"
|
|
293
|
-
],
|
|
294
|
-
"properties": {
|
|
295
|
-
"own": {
|
|
296
|
-
"$ref": "#/$defs/vessel"
|
|
297
|
-
},
|
|
298
|
-
"other": {
|
|
299
|
-
"$ref": "#/$defs/vessel"
|
|
300
|
-
},
|
|
301
|
-
"pair": {
|
|
302
|
-
"type": "object",
|
|
303
|
-
"additionalProperties": false,
|
|
304
|
-
"properties": {
|
|
305
|
-
"geo": {
|
|
306
|
-
"$ref": "#/$defs/geoRecord"
|
|
307
|
-
},
|
|
308
|
-
"env": {
|
|
309
|
-
"$ref": "#/$defs/envRecord"
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
176
|
+
"$comment": "A Situation (schema/situation.schema.json, ADR 0014).",
|
|
177
|
+
"$ref": "situation.schema.json"
|
|
314
178
|
}
|
|
315
179
|
}
|
|
316
180
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/situation.schema.json",
|
|
4
|
+
"title": "Situation",
|
|
5
|
+
"description": "Two vessels and the encounter at one instant: the input evaluateEncounter reads, nested by subject and class (ADR 0005 §2, ADR 0011 §3, ADR 0014). Structure only -- every kin:/geo:/hist:/env: key must be declared in data/facts.json §situation, checked in the tests.",
|
|
6
|
+
"$comment": "The same shape as a case's `situation` in schema/situation-fixtures.schema.json, stated once here so an operation can name it; `own` required, `other` optional (Rule 19's single-vessel scope), every class and key optional -- absent is absent.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"required": ["own"],
|
|
10
|
+
"properties": {
|
|
11
|
+
"own": { "$ref": "#/$defs/subject" },
|
|
12
|
+
"other": { "$ref": "#/$defs/subject" },
|
|
13
|
+
"pair": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"properties": {
|
|
17
|
+
"geo": { "$ref": "#/$defs/geoRecord" },
|
|
18
|
+
"env": { "$ref": "#/$defs/envRecord" }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"$defs": {
|
|
23
|
+
"scalar": {
|
|
24
|
+
"oneOf": [
|
|
25
|
+
{ "type": "string", "pattern": "^[a-z][a-z0-9_]*:[a-z0-9_]+$" },
|
|
26
|
+
{ "type": "number" },
|
|
27
|
+
{ "type": "boolean" },
|
|
28
|
+
{ "type": "null" },
|
|
29
|
+
{
|
|
30
|
+
"type": "object",
|
|
31
|
+
"additionalProperties": false,
|
|
32
|
+
"required": ["latitude", "longitude"],
|
|
33
|
+
"properties": {
|
|
34
|
+
"latitude": { "type": "number", "minimum": -90, "maximum": 90 },
|
|
35
|
+
"longitude": { "type": "number", "minimum": -180, "maximum": 180 }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"kinRecord": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"additionalProperties": false,
|
|
43
|
+
"patternProperties": { "^kin:[a-z0-9_]+$": { "$ref": "#/$defs/scalar" } }
|
|
44
|
+
},
|
|
45
|
+
"geoRecord": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"additionalProperties": false,
|
|
48
|
+
"patternProperties": { "^geo:[a-z0-9_]+$": { "$ref": "#/$defs/scalar" } }
|
|
49
|
+
},
|
|
50
|
+
"histRecord": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"additionalProperties": false,
|
|
53
|
+
"patternProperties": { "^hist:[a-z0-9_]+$": { "$ref": "#/$defs/scalar" } }
|
|
54
|
+
},
|
|
55
|
+
"envRecord": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"additionalProperties": false,
|
|
58
|
+
"patternProperties": { "^env:[a-z0-9_]+$": { "$ref": "#/$defs/scalar" } }
|
|
59
|
+
},
|
|
60
|
+
"subject": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"additionalProperties": false,
|
|
63
|
+
"required": ["fact"],
|
|
64
|
+
"properties": {
|
|
65
|
+
"fact": { "$ref": "fact-record.schema.json" },
|
|
66
|
+
"kin": { "$ref": "#/$defs/kinRecord" },
|
|
67
|
+
"geo": { "$ref": "#/$defs/geoRecord" },
|
|
68
|
+
"hist": { "$ref": "#/$defs/histRecord" }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/trace.schema.json",
|
|
4
|
+
"title": "Trace",
|
|
5
|
+
"description": "The situation over time: the window evaluateConduct reads (ADR 0012 §2, ADR 0014). A conforming implementation rejects an empty samples list, a `t_s` that does not strictly increase, and `other` present in some samples and absent in others; `t_s` is seconds on the caller's clock, read as differences only, and the pair's identity is the caller's, since a Situation names no vessel. Structure only.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"samples"
|
|
10
|
+
],
|
|
11
|
+
"properties": {
|
|
12
|
+
"samples": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"minItems": 1,
|
|
15
|
+
"items": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"required": [
|
|
19
|
+
"t_s",
|
|
20
|
+
"situation"
|
|
21
|
+
],
|
|
22
|
+
"properties": {
|
|
23
|
+
"t_s": {
|
|
24
|
+
"type": "number"
|
|
25
|
+
},
|
|
26
|
+
"situation": {
|
|
27
|
+
"$ref": "situation.schema.json"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"entry:14a": {
|
|
3
|
-
"denoted": "The head-on classification: encounter head-on when each vessel has the other ahead or nearly ahead, cited to 14(a). Renamed when the cite moved to 14(b), the deeming paragraph the entry actually reads (Q-45); the predicate and effect are unchanged.",
|
|
4
|
-
"deprecated_in": "0.2.0",
|
|
5
|
-
"replacement": "entry:14b"
|
|
6
|
-
}
|
|
7
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://github.com/mark-brannan/colregs/schema/deprecated-identifiers.schema.json",
|
|
4
|
-
"title": "data/deprecated-identifiers.json",
|
|
5
|
-
"description": "REQ-MODEL-11's deprecation registry: every retired identifier, what it denoted, the version that deprecated it, and its replacement where one exists. Keys are the same prefixed forms the identifier diff compares (test/data.test.mjs's extractIdentifiers) -- e.g. 'entry:25d2', 'paragraph:27(a)(i)', 'light:masthead', 'fact-key:activity', 'fact-value:activity:nuc', 'rel:includes'. Structure only -- see docs/adr/0006-json-schema-and-identifier-diff.md.",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"additionalProperties": {
|
|
8
|
-
"type": "object",
|
|
9
|
-
"additionalProperties": false,
|
|
10
|
-
"required": ["denoted", "deprecated_in"],
|
|
11
|
-
"properties": {
|
|
12
|
-
"denoted": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"minLength": 1,
|
|
15
|
-
"description": "What the identifier meant, so a consumer pinned to an old version can resolve a stale reference without the identifier itself."
|
|
16
|
-
},
|
|
17
|
-
"deprecated_in": {
|
|
18
|
-
"type": "string",
|
|
19
|
-
"pattern": "^\\d+\\.\\d+\\.\\d+$",
|
|
20
|
-
"description": "The released version that deprecated this identifier (REQ-MODEL-10)."
|
|
21
|
-
},
|
|
22
|
-
"replacement": {
|
|
23
|
-
"type": ["string", "null"],
|
|
24
|
-
"minLength": 1,
|
|
25
|
-
"description": "The identifier that replaces this one, in the same prefixed form, or null where nothing replaces it."
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|