colregs 0.3.0 → 0.3.2
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 +13 -11
- package/data/applicability.json +478 -503
- package/data/facts.json +22 -22
- 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 +7 -7
- package/docs/adr/0012-trace-and-rule2-departure-api.md +2 -2
- 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/adr/0016-encounter-roles-are-pooled-across-frames.md +82 -0
- package/docs/adr/0017-closed-vocabularies-are-prefixed-identifiers.md +105 -0
- package/docs/budgets.json +8 -15
- package/docs/decisions.md +6 -0
- package/docs/identifiers.md +121 -109
- package/docs/maritime-sources.md +58 -0
- package/docs/normative-language.md +103 -0
- package/docs/part-b-invariants.md +48 -45
- package/docs/requirements.md +147 -138
- package/fixtures/applicability-fixtures.json +190 -190
- package/fixtures/situation-fixtures.json +870 -599
- package/package.json +1 -1
- package/schema/applicability-fixtures.schema.json +4 -13
- package/schema/applicability.schema.json +77 -77
- 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/facts.schema.json +4 -4
- 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 +30 -127
- 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,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
|
+
"encounter:head-on",
|
|
34
|
+
"encounter:crossing",
|
|
35
|
+
"encounter:overtaking",
|
|
36
|
+
"encounter: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
|
+
"self",
|
|
60
|
+
"other"
|
|
61
|
+
],
|
|
62
|
+
"properties": {
|
|
63
|
+
"self": {
|
|
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
|
+
"category:care",
|
|
112
|
+
"category: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
|
+
}
|
package/schema/facts.schema.json
CHANGED
|
@@ -578,12 +578,12 @@
|
|
|
578
578
|
"type": "object",
|
|
579
579
|
"additionalProperties": false,
|
|
580
580
|
"required": [
|
|
581
|
-
"
|
|
581
|
+
"self",
|
|
582
582
|
"other",
|
|
583
583
|
"pair"
|
|
584
584
|
],
|
|
585
585
|
"properties": {
|
|
586
|
-
"
|
|
586
|
+
"self": {
|
|
587
587
|
"type": "string"
|
|
588
588
|
},
|
|
589
589
|
"other": {
|
|
@@ -716,12 +716,12 @@
|
|
|
716
716
|
"type": "object",
|
|
717
717
|
"additionalProperties": false,
|
|
718
718
|
"required": [
|
|
719
|
-
"
|
|
719
|
+
"self",
|
|
720
720
|
"other",
|
|
721
721
|
"pair"
|
|
722
722
|
],
|
|
723
723
|
"properties": {
|
|
724
|
-
"
|
|
724
|
+
"self": {
|
|
725
725
|
"type": "object",
|
|
726
726
|
"additionalProperties": false,
|
|
727
727
|
"properties": {
|
|
@@ -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. Every section is keyed by the identifier itself, as documented in docs/identifiers.md -- light identifiers (light:) and closed-vocabulary identifiers (modality:, and any of role:/encounter:/category: that gain a catalog section) alike, 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": "^modality:[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
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/rule2-departure-finding.schema.json",
|
|
4
|
+
"title": "Rule2DepartureFinding",
|
|
5
|
+
"description": "The result of evaluateRule2Departure: what a named grid found for a situation, with the rule-derived obligations unchanged beside it and the model that made the claim (ADR 0012 §4, ADR 0014). Advisories are ranked best margin first and are empty under no-robust-policy-in-model. Structure only.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"status",
|
|
10
|
+
"rules",
|
|
11
|
+
"advisories",
|
|
12
|
+
"model"
|
|
13
|
+
],
|
|
14
|
+
"properties": {
|
|
15
|
+
"status": {
|
|
16
|
+
"$ref": "rule2-departure-model.schema.json#/$defs/status"
|
|
17
|
+
},
|
|
18
|
+
"rules": {
|
|
19
|
+
"$ref": "encounter-evaluation.schema.json"
|
|
20
|
+
},
|
|
21
|
+
"advisories": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"items": {
|
|
24
|
+
"$ref": "rule2-departure-model.schema.json#/$defs/advisory"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"model": {
|
|
28
|
+
"$comment": "`version` names the grid, `colregs_version` the release it was solved against; a mismatch with rules.colregs.version is reported, not refused. `assumptions_violated` is display text, never matched on.",
|
|
29
|
+
"type": "object",
|
|
30
|
+
"additionalProperties": false,
|
|
31
|
+
"required": [
|
|
32
|
+
"version",
|
|
33
|
+
"colregs_version",
|
|
34
|
+
"parameters",
|
|
35
|
+
"assumptions_violated"
|
|
36
|
+
],
|
|
37
|
+
"properties": {
|
|
38
|
+
"version": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"minLength": 1
|
|
41
|
+
},
|
|
42
|
+
"colregs_version": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1
|
|
45
|
+
},
|
|
46
|
+
"parameters": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"allOf": [
|
|
49
|
+
{
|
|
50
|
+
"$ref": "rule2-departure-model.schema.json#/$defs/solverParameters"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"required": [
|
|
54
|
+
"dynamics",
|
|
55
|
+
"horizon_s",
|
|
56
|
+
"cadence_s",
|
|
57
|
+
"separation_m",
|
|
58
|
+
"information",
|
|
59
|
+
"adversary"
|
|
60
|
+
],
|
|
61
|
+
"unevaluatedProperties": false
|
|
62
|
+
},
|
|
63
|
+
"assumptions_violated": {
|
|
64
|
+
"type": "array",
|
|
65
|
+
"items": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|