colregs 0.2.4 → 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/PROVENANCE.md +3 -3
- package/README.md +19 -10
- package/data/applicability.json +219 -244
- package/data/corpora.json +41 -0
- package/data/editions.json +27 -0
- 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 +176 -599
- package/data/text/intl/2016/en-US.uscg.json +877 -0
- package/data/text/intl/2016/es.boe.json +23 -0
- package/data/text/intl/2016/fi.finlex.json +22 -0
- package/data/text/us/inland/2014/en-US.ecfr.json +22 -0
- package/data/version.json +1 -1
- package/docs/adr/0001-name-and-jurisdiction-model.md +42 -2
- package/docs/adr/0003-language-as-a-dimension.md +8 -7
- package/docs/adr/0006-json-schema-and-identifier-diff.md +2 -0
- package/docs/adr/0011-api-shape.md +1 -1
- package/docs/adr/0012-trace-and-rule2-departure-api.md +3 -4
- package/docs/adr/0013-corpus-files-with-editions.md +70 -0
- 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 +17 -17
- package/docs/gates.json +3 -3
- 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 +118 -97
- package/docs/timeline.md +102 -0
- package/docs/verification/2026-09-09-text-slug-straw-man.md +3 -2
- 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/corpora.schema.json +68 -0
- package/schema/corpus.schema.json +329 -0
- package/schema/display-evaluation.schema.json +146 -0
- package/schema/editions.schema.json +47 -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/rules.schema.json +20 -90
- 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
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/display-evaluation.schema.json",
|
|
4
|
+
"title": "DisplayEvaluation",
|
|
5
|
+
"description": "The result of evaluateDisplay: every complete lawful display for one vessel, alternatives unresolved (REQ-MODEL-8), with the data it was read against (ADR 0011 §1, ADR 0014). Structure only; the $defs shared with the other envelopes live in schema/evaluation.schema.json.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"colregs",
|
|
10
|
+
"applied",
|
|
11
|
+
"exempted",
|
|
12
|
+
"excluded",
|
|
13
|
+
"overridden",
|
|
14
|
+
"displays",
|
|
15
|
+
"optional_additions",
|
|
16
|
+
"modalities",
|
|
17
|
+
"categories",
|
|
18
|
+
"provenance"
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"colregs": {
|
|
22
|
+
"$ref": "evaluation.schema.json#/$defs/colregs"
|
|
23
|
+
},
|
|
24
|
+
"applied": {
|
|
25
|
+
"$ref": "evaluation.schema.json#/$defs/ruleIds"
|
|
26
|
+
},
|
|
27
|
+
"exempted": {
|
|
28
|
+
"$ref": "evaluation.schema.json#/$defs/byEntryList"
|
|
29
|
+
},
|
|
30
|
+
"excluded": {
|
|
31
|
+
"$ref": "evaluation.schema.json#/$defs/byEntryList"
|
|
32
|
+
},
|
|
33
|
+
"overridden": {
|
|
34
|
+
"$ref": "evaluation.schema.json#/$defs/byEntryList"
|
|
35
|
+
},
|
|
36
|
+
"displays": {
|
|
37
|
+
"type": "array",
|
|
38
|
+
"items": {
|
|
39
|
+
"$ref": "#/$defs/display"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"optional_additions": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"items": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"required": [
|
|
48
|
+
"id",
|
|
49
|
+
"lights",
|
|
50
|
+
"cite"
|
|
51
|
+
],
|
|
52
|
+
"properties": {
|
|
53
|
+
"id": {
|
|
54
|
+
"$ref": "evaluation.schema.json#/$defs/ruleId"
|
|
55
|
+
},
|
|
56
|
+
"via": {
|
|
57
|
+
"$ref": "evaluation.schema.json#/$defs/ruleId"
|
|
58
|
+
},
|
|
59
|
+
"lights": {
|
|
60
|
+
"type": "array",
|
|
61
|
+
"items": {
|
|
62
|
+
"$ref": "#/$defs/displayLight"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"cite": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"minLength": 1
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"optionalAdditions": {
|
|
73
|
+
"deprecated": true,
|
|
74
|
+
"$comment": "Renamed to optional_additions (ADR 0011 §4); an implementation may still emit both.",
|
|
75
|
+
"type": "array",
|
|
76
|
+
"items": {
|
|
77
|
+
"$ref": "#/properties/optional_additions/items"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"modalities": {
|
|
81
|
+
"$ref": "evaluation.schema.json#/$defs/modalities"
|
|
82
|
+
},
|
|
83
|
+
"categories": {
|
|
84
|
+
"$ref": "evaluation.schema.json#/$defs/categories"
|
|
85
|
+
},
|
|
86
|
+
"provenance": {
|
|
87
|
+
"$ref": "evaluation.schema.json#/$defs/provenance"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"$defs": {
|
|
91
|
+
"displayLight": {
|
|
92
|
+
"type": "object",
|
|
93
|
+
"additionalProperties": false,
|
|
94
|
+
"required": [
|
|
95
|
+
"spec",
|
|
96
|
+
"source_entry",
|
|
97
|
+
"modality"
|
|
98
|
+
],
|
|
99
|
+
"properties": {
|
|
100
|
+
"spec": {
|
|
101
|
+
"$ref": "applicability.schema.json#/$defs/lightRef"
|
|
102
|
+
},
|
|
103
|
+
"source_entry": {
|
|
104
|
+
"$ref": "evaluation.schema.json#/$defs/ruleId"
|
|
105
|
+
},
|
|
106
|
+
"sourceEntry": {
|
|
107
|
+
"deprecated": true,
|
|
108
|
+
"$comment": "Renamed to source_entry (ADR 0011 §4).",
|
|
109
|
+
"$ref": "evaluation.schema.json#/$defs/ruleId"
|
|
110
|
+
},
|
|
111
|
+
"via": {
|
|
112
|
+
"$ref": "evaluation.schema.json#/$defs/ruleId"
|
|
113
|
+
},
|
|
114
|
+
"modality": {
|
|
115
|
+
"$ref": "applicability.schema.json#/$defs/modality"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"display": {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"additionalProperties": false,
|
|
122
|
+
"required": [
|
|
123
|
+
"entries",
|
|
124
|
+
"lights",
|
|
125
|
+
"chosen"
|
|
126
|
+
],
|
|
127
|
+
"properties": {
|
|
128
|
+
"entries": {
|
|
129
|
+
"$ref": "evaluation.schema.json#/$defs/ruleIds"
|
|
130
|
+
},
|
|
131
|
+
"lights": {
|
|
132
|
+
"type": "array",
|
|
133
|
+
"items": {
|
|
134
|
+
"$ref": "#/$defs/displayLight"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"chosen": {
|
|
138
|
+
"type": "array",
|
|
139
|
+
"items": {
|
|
140
|
+
"type": "string"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/editions.schema.json",
|
|
4
|
+
"title": "data/editions.json",
|
|
5
|
+
"description": "Registry of instruments and their editions, per jurisdiction: the layer GATE-2 asked for. The skeleton names the edition it consolidates; every corpus names the edition its text reflects; two editions of one jurisdiction may be registered at once. See docs/adr/0013-corpus-files-with-editions.md.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["jurisdictions"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"note": { "type": "string" },
|
|
11
|
+
"jurisdictions": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"additionalProperties": false,
|
|
14
|
+
"patternProperties": {
|
|
15
|
+
"^[a-z]+(/[a-z]+)*$": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"required": ["instrument", "skeleton", "editions"],
|
|
19
|
+
"properties": {
|
|
20
|
+
"instrument": { "$comment": "The body of rules this jurisdiction's editions are editions of.", "type": "string", "minLength": 1 },
|
|
21
|
+
"skeleton": {
|
|
22
|
+
"$comment": "Which edition data/rules.json consolidates for this jurisdiction; null while the skeleton has no paragraphs of it.",
|
|
23
|
+
"oneOf": [{ "type": "null" }, { "type": "string", "pattern": "^[a-z]+(/[a-z]+)*@[a-z0-9-]+$" }]
|
|
24
|
+
},
|
|
25
|
+
"editions": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"patternProperties": {
|
|
29
|
+
"^[a-z]+(/[a-z]+)*@[a-z0-9-]+$": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"additionalProperties": false,
|
|
32
|
+
"required": ["amended_through", "in_force"],
|
|
33
|
+
"properties": {
|
|
34
|
+
"amended_through": { "$comment": "Free text: national amalgamations cite their own amending acts, not IMO resolutions.", "type": "string", "minLength": 1 },
|
|
35
|
+
"in_force": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
|
|
36
|
+
"superseded_by": { "$comment": "The later edition, where two are registered and one has lapsed.", "type": "string", "pattern": "^[a-z]+(/[a-z]+)*@[a-z0-9-]+$" },
|
|
37
|
+
"note": { "type": "string" }
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/encounter-evaluation.schema.json",
|
|
4
|
+
"title": "EncounterEvaluation",
|
|
5
|
+
"description": "The result of evaluateEncounter: two vessels at one instant -- scope, encounter class, risk of collision with its grounds, roles as a set per subject, overrides and modalities (ADR 0011 §4, ADR 0014). Structure only.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"colregs",
|
|
10
|
+
"applied",
|
|
11
|
+
"scope",
|
|
12
|
+
"risk_of_collision",
|
|
13
|
+
"roles",
|
|
14
|
+
"overridden",
|
|
15
|
+
"modalities",
|
|
16
|
+
"categories",
|
|
17
|
+
"provenance"
|
|
18
|
+
],
|
|
19
|
+
"properties": {
|
|
20
|
+
"colregs": {
|
|
21
|
+
"$ref": "evaluation.schema.json#/$defs/colregs"
|
|
22
|
+
},
|
|
23
|
+
"applied": {
|
|
24
|
+
"$ref": "evaluation.schema.json#/$defs/ruleIds"
|
|
25
|
+
},
|
|
26
|
+
"scope": {
|
|
27
|
+
"$ref": "evaluation.schema.json#/$defs/ruleIds"
|
|
28
|
+
},
|
|
29
|
+
"encounter": {
|
|
30
|
+
"$comment": "Absent when no classification entry fired: cannot say, not none (Q-43).",
|
|
31
|
+
"type": "string",
|
|
32
|
+
"enum": [
|
|
33
|
+
"head-on",
|
|
34
|
+
"crossing",
|
|
35
|
+
"overtaking",
|
|
36
|
+
"none"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"risk_of_collision": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"additionalProperties": false,
|
|
42
|
+
"required": [
|
|
43
|
+
"asserted",
|
|
44
|
+
"by"
|
|
45
|
+
],
|
|
46
|
+
"properties": {
|
|
47
|
+
"asserted": {
|
|
48
|
+
"type": "boolean"
|
|
49
|
+
},
|
|
50
|
+
"by": {
|
|
51
|
+
"$ref": "evaluation.schema.json#/$defs/ruleIds"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"roles": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"additionalProperties": false,
|
|
58
|
+
"required": [
|
|
59
|
+
"own",
|
|
60
|
+
"other"
|
|
61
|
+
],
|
|
62
|
+
"properties": {
|
|
63
|
+
"own": {
|
|
64
|
+
"$ref": "#/$defs/subjectRoles"
|
|
65
|
+
},
|
|
66
|
+
"other": {
|
|
67
|
+
"$ref": "#/$defs/subjectRoles"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"overridden": {
|
|
72
|
+
"$ref": "evaluation.schema.json#/$defs/byEntryList"
|
|
73
|
+
},
|
|
74
|
+
"modalities": {
|
|
75
|
+
"$ref": "evaluation.schema.json#/$defs/modalities"
|
|
76
|
+
},
|
|
77
|
+
"categories": {
|
|
78
|
+
"$ref": "evaluation.schema.json#/$defs/categories"
|
|
79
|
+
},
|
|
80
|
+
"provenance": {
|
|
81
|
+
"$ref": "evaluation.schema.json#/$defs/provenance"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"$defs": {
|
|
85
|
+
"subjectRole": {
|
|
86
|
+
"$comment": "Roles are a set per subject, each citing the entry that assigned it (Q-36).",
|
|
87
|
+
"type": "object",
|
|
88
|
+
"additionalProperties": false,
|
|
89
|
+
"required": [
|
|
90
|
+
"role",
|
|
91
|
+
"by"
|
|
92
|
+
],
|
|
93
|
+
"properties": {
|
|
94
|
+
"role": {
|
|
95
|
+
"$ref": "applicability.schema.json#/$defs/effectRole"
|
|
96
|
+
},
|
|
97
|
+
"by": {
|
|
98
|
+
"$ref": "evaluation.schema.json#/$defs/ruleId"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"subjectRoles": {
|
|
103
|
+
"type": "array",
|
|
104
|
+
"items": {
|
|
105
|
+
"$ref": "#/$defs/subjectRole"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/evaluation.schema.json",
|
|
4
|
+
"title": "Evaluation",
|
|
5
|
+
"description": "The $defs every result envelope shares (ADR 0014): the colregs provenance stamp, what an evaluation read, entry-id and paragraph-cite vocabularies. No instance validates against the root; the envelopes under schema/*-evaluation.schema.json and the operations manifest $ref into $defs here.",
|
|
6
|
+
"$defs": {
|
|
7
|
+
"ruleId": {
|
|
8
|
+
"$ref": "applicability.schema.json#/$defs/ruleId"
|
|
9
|
+
},
|
|
10
|
+
"ruleIds": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": {
|
|
13
|
+
"$ref": "#/$defs/ruleId"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"paragraphCite": {
|
|
17
|
+
"$comment": "A Rules paragraph path, the vocabulary of `phase` and `breaches` (ADR 0011 §4); the pattern is data/rules.json's paragraph key, and the tests hold the two equal.",
|
|
18
|
+
"type": "string",
|
|
19
|
+
"pattern": "^[0-9]+(\\([a-z]\\))?(\\([ivx]+\\))?$"
|
|
20
|
+
},
|
|
21
|
+
"colregs": {
|
|
22
|
+
"$comment": "`resolved`: the data is the implementation's own colregs dependency and `version` describes it exactly. `caller`: the caller supplied the data and `version` names only the release the implementation resolved.",
|
|
23
|
+
"type": "object",
|
|
24
|
+
"additionalProperties": false,
|
|
25
|
+
"required": [
|
|
26
|
+
"version",
|
|
27
|
+
"source"
|
|
28
|
+
],
|
|
29
|
+
"properties": {
|
|
30
|
+
"version": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"minLength": 1
|
|
33
|
+
},
|
|
34
|
+
"source": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"enum": [
|
|
37
|
+
"resolved",
|
|
38
|
+
"caller"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"byEntry": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"required": [
|
|
47
|
+
"id",
|
|
48
|
+
"by"
|
|
49
|
+
],
|
|
50
|
+
"properties": {
|
|
51
|
+
"id": {
|
|
52
|
+
"$ref": "#/$defs/ruleId"
|
|
53
|
+
},
|
|
54
|
+
"by": {
|
|
55
|
+
"$ref": "#/$defs/ruleId"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"byEntryList": {
|
|
60
|
+
"type": "array",
|
|
61
|
+
"items": {
|
|
62
|
+
"$ref": "#/$defs/byEntry"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"modalities": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"additionalProperties": false,
|
|
68
|
+
"patternProperties": {
|
|
69
|
+
"^rule:[0-9]+[a-z]?(_[ivx]+)*(:[a-z][a-z0-9_]*)?$": {
|
|
70
|
+
"$ref": "applicability.schema.json#/$defs/modality"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"categories": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"additionalProperties": false,
|
|
77
|
+
"patternProperties": {
|
|
78
|
+
"^rule:[0-9]+[a-z]?(_[ivx]+)*(:[a-z][a-z0-9_]*)?$": {
|
|
79
|
+
"$ref": "#/$defs/ruleCategory"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"ruleCategory": {
|
|
84
|
+
"$ref": "applicability.schema.json#/$defs/ruleCategory"
|
|
85
|
+
},
|
|
86
|
+
"representedParagraph": {
|
|
87
|
+
"$comment": "One of data/applicability.json's represented_paragraphs without its note: an evaluation carries the identity, not the prose.",
|
|
88
|
+
"type": "object",
|
|
89
|
+
"additionalProperties": false,
|
|
90
|
+
"required": [
|
|
91
|
+
"id",
|
|
92
|
+
"jurisdiction",
|
|
93
|
+
"cite",
|
|
94
|
+
"category"
|
|
95
|
+
],
|
|
96
|
+
"properties": {
|
|
97
|
+
"id": {
|
|
98
|
+
"$ref": "applicability.schema.json#/$defs/ruleId"
|
|
99
|
+
},
|
|
100
|
+
"jurisdiction": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"pattern": "^[a-z]+(/[a-z]+)*$"
|
|
103
|
+
},
|
|
104
|
+
"cite": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"minLength": 1
|
|
107
|
+
},
|
|
108
|
+
"category": {
|
|
109
|
+
"type": "string",
|
|
110
|
+
"enum": [
|
|
111
|
+
"care",
|
|
112
|
+
"meta"
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"provenance": {
|
|
118
|
+
"$comment": "What an evaluation read, and therefore what its answer does not cover: the categories it matched, the jurisdictions offered, and the paragraphs no verb computes.",
|
|
119
|
+
"type": "object",
|
|
120
|
+
"additionalProperties": false,
|
|
121
|
+
"required": [
|
|
122
|
+
"evaluated_categories",
|
|
123
|
+
"jurisdictions",
|
|
124
|
+
"represented"
|
|
125
|
+
],
|
|
126
|
+
"properties": {
|
|
127
|
+
"evaluated_categories": {
|
|
128
|
+
"type": "array",
|
|
129
|
+
"items": {
|
|
130
|
+
"$ref": "#/$defs/ruleCategory"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"jurisdictions": {
|
|
134
|
+
"type": "array",
|
|
135
|
+
"items": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"pattern": "^[a-z]+(/[a-z]+)*$"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"represented": {
|
|
141
|
+
"type": "array",
|
|
142
|
+
"items": {
|
|
143
|
+
"$ref": "#/$defs/representedParagraph"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/fact-record.schema.json",
|
|
4
|
+
"title": "FactRecord",
|
|
5
|
+
"description": "What a consumer asserts about one vessel at one moment: the input evaluateDisplay reads (ADR 0011 §2, ADR 0014). Structure only -- which fact keys exist and which values each takes is data/facts.json's, checked in the tests; see docs/adr/0006-json-schema-and-identifier-diff.md.",
|
|
6
|
+
"$comment": "A case's `facts` in schema/applicability-fixtures.schema.json is this shape plus minProperties: 1 -- a fixture must assert something; an evaluation input need not, and `{}` is a record that asserts nothing. Values are string, number or boolean, as data/facts.json declares them; null and positions belong to the situation classes.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"patternProperties": {
|
|
10
|
+
"^fact:[a-z0-9_]+$": {
|
|
11
|
+
"$ref": "#/$defs/factValue"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"$defs": {
|
|
15
|
+
"factValue": {
|
|
16
|
+
"oneOf": [
|
|
17
|
+
{
|
|
18
|
+
"type": "string",
|
|
19
|
+
"pattern": "^[a-z][a-z0-9_]*:[a-z0-9_]+$"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "number"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"type": "boolean"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/i18n-catalog.schema.json",
|
|
4
|
+
"title": "data/i18n/*.json",
|
|
5
|
+
"description": "Display catalog for one BCP 47 language: UI strings for identifier vocabularies (light names, fact-axis labels, modality labels, image captions), not legal text -- see docs/adr/0003-language-as-a-dimension.md 'Display catalogs'.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["language", "provenance", "strings"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"language": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"pattern": "^[a-z]{2,3}(-[A-Za-z0-9]+)*$",
|
|
13
|
+
"description": "BCP 47 tag, e.g. en, fi. Must equal the filename stem; test/data.test.mjs checks."
|
|
14
|
+
},
|
|
15
|
+
"provenance": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"required": ["contributors", "reviewed_by", "review_date"],
|
|
19
|
+
"properties": {
|
|
20
|
+
"contributors": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
|
|
21
|
+
"reviewed_by": { "type": "array", "items": { "type": "string" }, "description": "Named human reviewers. Empty means unreviewed: the strings are on file but not yet vouched for." },
|
|
22
|
+
"review_date": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
|
|
23
|
+
"licence": { "type": "string", "description": "Optional until the data licence question (Q-9) is ruled; absent means the package licence applies." }
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"strings": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"description": "One section per vocabulary. Identifier vocabularies (light) are keyed by the identifier itself, as documented in docs/identifiers.md; closed vocabularies (modality) by their bare value, as stored in data/applicability.json. Values are static strings: no interpolation, no plurals -- the consumer's i18n system owns composition.",
|
|
29
|
+
"additionalProperties": false,
|
|
30
|
+
"properties": {
|
|
31
|
+
"light": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"propertyNames": { "pattern": "^light:[a-z_]+$" },
|
|
34
|
+
"additionalProperties": { "$ref": "#/$defs/label" }
|
|
35
|
+
},
|
|
36
|
+
"modality": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"propertyNames": { "pattern": "^[a-z]+(-[a-z]+)*$" },
|
|
39
|
+
"additionalProperties": { "$ref": "#/$defs/label" }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"$defs": {
|
|
45
|
+
"label": { "type": "string", "minLength": 1 }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/operations.schema.json",
|
|
4
|
+
"title": "data/operations.json",
|
|
5
|
+
"description": "The engine interface colregs owns (ADR 0014): one operation per verb ADR 0011 and ADR 0012 name, each binding its positional inputs and its result to a schema under schema/, its entry-id companion, and the fixture cases that exercise it. Structure only -- that every schema reference resolves and every fixture file is bound is checked in the tests.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"operations"
|
|
10
|
+
],
|
|
11
|
+
"$defs": {
|
|
12
|
+
"verb": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"pattern": "^[a-z][A-Za-z0-9]*$"
|
|
15
|
+
},
|
|
16
|
+
"schemaRef": {
|
|
17
|
+
"$comment": "A file under schema/, optionally with a JSON pointer into it; relative to the package root.",
|
|
18
|
+
"type": "string",
|
|
19
|
+
"pattern": "^schema/[a-z0-9-]+\\.schema\\.json(#/[^#]+)?$"
|
|
20
|
+
},
|
|
21
|
+
"adr": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"pattern": "^[0-9]{4}$"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"properties": {
|
|
27
|
+
"note": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
30
|
+
"operations": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"minProperties": 1,
|
|
34
|
+
"patternProperties": {
|
|
35
|
+
"^[a-z][A-Za-z0-9]*$": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"additionalProperties": false,
|
|
38
|
+
"required": [
|
|
39
|
+
"adr",
|
|
40
|
+
"inputs",
|
|
41
|
+
"output",
|
|
42
|
+
"fixtures"
|
|
43
|
+
],
|
|
44
|
+
"properties": {
|
|
45
|
+
"adr": {
|
|
46
|
+
"$ref": "#/$defs/adr"
|
|
47
|
+
},
|
|
48
|
+
"inputs": {
|
|
49
|
+
"$comment": "Positional, in call order. Anything a binding accepts after them (an options bag, a data override) is the binding's own and is not named here.",
|
|
50
|
+
"type": "array",
|
|
51
|
+
"minItems": 1,
|
|
52
|
+
"items": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"additionalProperties": false,
|
|
55
|
+
"required": [
|
|
56
|
+
"name",
|
|
57
|
+
"schema"
|
|
58
|
+
],
|
|
59
|
+
"properties": {
|
|
60
|
+
"name": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"pattern": "^[a-z][a-z0-9_]*$"
|
|
63
|
+
},
|
|
64
|
+
"schema": {
|
|
65
|
+
"$ref": "#/$defs/schemaRef"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"output": {
|
|
71
|
+
"$ref": "#/$defs/schemaRef"
|
|
72
|
+
},
|
|
73
|
+
"companion": {
|
|
74
|
+
"$comment": "The verb that takes the same inputs and answers only the applied entry ids -- the fixture contract, since every fixture case `expect`s entry ids.",
|
|
75
|
+
"type": "object",
|
|
76
|
+
"additionalProperties": false,
|
|
77
|
+
"required": [
|
|
78
|
+
"verb",
|
|
79
|
+
"output"
|
|
80
|
+
],
|
|
81
|
+
"properties": {
|
|
82
|
+
"verb": {
|
|
83
|
+
"$ref": "#/$defs/verb"
|
|
84
|
+
},
|
|
85
|
+
"output": {
|
|
86
|
+
"$ref": "#/$defs/schemaRef"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"fixtures": {
|
|
91
|
+
"$comment": "Each binds a fixture file whose `cases[]` carry this operation's inputs, in order, under the `case_inputs` keys, and the expected answer under `expect` -- the companion's entry ids unless `expect` names another schema. A case's `status` and `jurisdiction` are the fixture file's own and are read there. Empty until a fixture file for the input exists.",
|
|
92
|
+
"type": "array",
|
|
93
|
+
"items": {
|
|
94
|
+
"type": "object",
|
|
95
|
+
"additionalProperties": false,
|
|
96
|
+
"required": [
|
|
97
|
+
"file",
|
|
98
|
+
"case_inputs"
|
|
99
|
+
],
|
|
100
|
+
"properties": {
|
|
101
|
+
"file": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"pattern": "^fixtures/[a-z0-9-]+\\.json$"
|
|
104
|
+
},
|
|
105
|
+
"case_inputs": {
|
|
106
|
+
"type": "array",
|
|
107
|
+
"minItems": 1,
|
|
108
|
+
"items": {
|
|
109
|
+
"type": "string",
|
|
110
|
+
"pattern": "^[a-z][a-z0-9_]*$"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"expect": {
|
|
114
|
+
"$ref": "#/$defs/schemaRef"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|