rsmp_schema 0.8.5 → 0.8.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27c2190ce73299078c227b01b0da79f701bd94b5138504f1990a6ac16c3b0142
4
- data.tar.gz: a912fd64f18d9f06608f358a97a08b0b9451e5afc26a5cdde728347778bbb9f8
3
+ metadata.gz: 8ef1bab7d72db34cc48ea2d84a02347969813176b3863f2c4fe389a75f1ad675
4
+ data.tar.gz: a05f416ef16d617cdd10e880a637fd8055ad94c84fcc542b993b78b8ceb3d3a8
5
5
  SHA512:
6
- metadata.gz: 48f6469aec64aaab51e1cd0f33cabb1c83e8e049c95c906ca22a11a5c1b821c287d87e9e13db8ccdd7cc8d801a045f3cc5b9aeb087268feb0869570af3b98907
7
- data.tar.gz: 912db9bb17a87cddfef109e0bfd036039ad485dfe00155b1863c3bf6cb5564cc895f6f2738652aff447a08f03bd53bdec7c92343322fba9de501e8012021d8f8
6
+ metadata.gz: 306e7c93c4cf1ef11ab4054d8fa977a3136d307db389dbf202f03d6581afe8ae5e1d6f9866811a5cb057e4dc786b2b96bef99fea8087c3a6ccab1b6ef1177916
7
+ data.tar.gz: 75b6ba3cdadd114544e89515acc1453db3511f95e103bdee96a65268ef6af656412e1bb6debe0f17724987a10dead2e4bacbaa9052f03fb7d9eb310bec322931
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp_schema (0.8.5)
4
+ rsmp_schema (0.8.6)
5
5
  json_schemer (~> 2.3.0)
6
6
  thor (~> 1.3.1)
7
7
 
@@ -1,5 +1,5 @@
1
1
  module RSMP
2
2
  module Schema
3
- VERSION = "0.8.5"
3
+ VERSION = "0.8.6"
4
4
  end
5
5
  end
@@ -13,13 +13,9 @@
13
13
  "type" : "object",
14
14
  "properties": {
15
15
  "sCI" : { "$ref": "definitions.json#/status_code" },
16
- "n" : { "description" : "Value name", "type" : "string" },
16
+ "n" : { "description" : "Value identifier", "type" : "string" },
17
17
  "s" : { "description" : "Value", "type" : "string" },
18
- "q" : {
19
- "description" : "Quality",
20
- "type" : "string",
21
- "enum" : [ "recent", "old", "undefined", "unknown" ]
22
- }
18
+ "q" : { "description" : "Quality", "type" : "string", "enum" : [ "recent", "old", "unknown" ] }
23
19
  },
24
20
  "required" : [ "sCI", "n", "s", "q" ],
25
21
  "additionalProperties": false
@@ -13,13 +13,9 @@
13
13
  "type" : "object",
14
14
  "properties": {
15
15
  "sCI" : { "$ref": "definitions.json#/status_code" },
16
- "n" : { "description" : "Unique reference of the value", "type" : "string" },
16
+ "n" : { "description" : "Value identifier", "type" : "string" },
17
17
  "s" : { "description" : "Value", "type" : "string" },
18
- "q" : {
19
- "description" : "Value",
20
- "type" : "string",
21
- "enum" : [ "recent", "old", "undefined", "unknown" ]
22
- }
18
+ "q" : { "description" : "Quality", "type" : "string", "enum" : [ "recent", "old", "unknown" ] }
23
19
  },
24
20
  "required" : [ "sCI", "n", "s", "q" ],
25
21
  "additionalProperties": false
@@ -11,33 +11,29 @@
11
11
  "minItems": 1,
12
12
  "items" : {
13
13
  "type" : "object",
14
- "allOf" : [
15
- {
16
- "required" : [ "sCI", "n", "s", "q" ],
17
- "additionalProperties" : false,
18
- "properties": {
19
- "sCI" : { "$ref": "../3.1.2/definitions.json#/status_code" },
20
- "n" : { "description" : "Value name", "type" : "string" },
21
- "q" : { "description" : "Quality", "type" : "string" },
22
- "s" : { "description" : "Value" }
23
- }
24
- },
25
- {
26
- "if" : {
27
- "required" : [ "q" ],
28
- "properties": { "q" : { "const": "undefined" }}
29
- },
30
- "then" : {
31
- "properties": { "s" : { "type": "null" }}
32
- },
33
- "else" : {
34
- "properties": {
35
- "s" : { "type" : ["string"] },
36
- "q" : { "enum" : [ "recent", "old", "unknown" ] }
37
- }
38
- }
14
+ "properties": {
15
+ "sCI" : { "$ref": "../3.1.2/definitions.json#/status_code" },
16
+ "n" : { "description" : "Value identifier", "type" : "string" },
17
+ "s" : { "description" : "Value"},
18
+ "q" : { "description" : "Quality", "type" : "string", "enum" : [ "recent", "old", "unknown", "undefined"] }
19
+ },
20
+ "if": {
21
+ "properties": {
22
+ "q" : { "enum" : ["unknown","undefined"] }
39
23
  }
40
- ]
24
+ },
25
+ "then": {
26
+ "properties": {
27
+ "s" : { "type" : "null" }
28
+ }
29
+ },
30
+ "else": {
31
+ "properties": {
32
+ "s" : { "type" : "string" }
33
+ }
34
+ },
35
+ "required" : [ "sCI", "n", "s", "q" ],
36
+ "additionalProperties": false
41
37
  }
42
38
  }
43
39
  },
@@ -1,4 +1,4 @@
1
- {
1
+ {
2
2
  "title" : "StatusUpdate",
3
3
  "description" : "Status update",
4
4
  "properties" : {
@@ -13,12 +13,23 @@
13
13
  "type" : "object",
14
14
  "properties": {
15
15
  "sCI" : { "$ref": "../3.1.2/definitions.json#/status_code" },
16
- "n" : { "description" : "Unique reference of the value", "type" : "string" },
17
- "s" : { "description" : "Value", "type" : "string" },
18
- "q" : {
19
- "description" : "Value",
20
- "type" : "string",
21
- "enum" : [ "recent", "old", "undefined", "unknown" ] // 'undefined' was addded
16
+ "n" : { "description" : "Value identifier", "type" : "string" },
17
+ "s" : { "description" : "Value"},
18
+ "q" : { "description" : "Quality", "type" : "string", "enum" : [ "recent", "old", "unknown", "undefined"] }
19
+ },
20
+ "if": {
21
+ "properties": {
22
+ "q" : { "enum" : ["unknown","undefined"] }
23
+ }
24
+ },
25
+ "then": {
26
+ "properties": {
27
+ "s" : { "type" : "null" }
28
+ }
29
+ },
30
+ "else": {
31
+ "properties": {
32
+ "s" : { "type" : "string" }
22
33
  }
23
34
  },
24
35
  "required" : [ "sCI", "n", "s", "q" ],
@@ -11,33 +11,29 @@
11
11
  "minItems": 1,
12
12
  "items" : {
13
13
  "type" : "object",
14
- "allOf" : [
15
- {
16
- "required" : [ "sCI", "n", "s", "q" ],
17
- "additionalProperties" : false,
18
- "properties": {
19
- "sCI" : { "$ref": "../3.1.2/definitions.json#/status_code" },
20
- "n" : { "description" : "Unique reference of the value", "type" : "string" },
21
- "q" : { "description" : "Quality", "type" : "string" },
22
- "s" : { "description" : "Value" }
23
- }
24
- },
25
- {
26
- "if" : {
27
- "required" : [ "q" ],
28
- "properties": { "q" : { "const": "undefined" }}
29
- },
30
- "then" : {
31
- "properties": { "s" : { "type": "null" }}
32
- },
33
- "else" : {
34
- "properties": {
35
- "s" : { "type" : [ "string", "array" ] },
36
- "q" : { "enum" : [ "recent", "old", "unknown" ] }
37
- }
38
- }
14
+ "properties": {
15
+ "sCI" : { "$ref": "../3.1.2/definitions.json#/status_code" },
16
+ "n" : { "description" : "Unique reference of the value", "type" : "string" },
17
+ "s" : { "description" : "Value"},
18
+ "q" : { "description" : "Quality", "type" : "string", "enum" : [ "recent", "old", "undefined", "unknown"] }
19
+ },
20
+ "if": {
21
+ "properties": {
22
+ "q" : { "enum" : ["unknown","undefined"] }
39
23
  }
40
- ]
24
+ },
25
+ "then": {
26
+ "properties": {
27
+ "s" : { "type" : "null" }
28
+ }
29
+ },
30
+ "else": {
31
+ "properties": {
32
+ "s" : { "type" : ["string","array"] }
33
+ }
34
+ },
35
+ "required" : [ "sCI", "n", "s", "q" ],
36
+ "additionalProperties": false
41
37
  }
42
38
  }
43
39
  },
@@ -14,11 +14,22 @@
14
14
  "properties": {
15
15
  "sCI" : { "$ref": "../3.1.2/definitions.json#/status_code" },
16
16
  "n" : { "description" : "Unique reference of the value", "type" : "string" },
17
- "s" : { "description" : "Value", "type" : ["string","array"] }, // array is allowed from 3.2.0
18
- "q" : {
19
- "description" : "Value",
20
- "type" : "string",
21
- "enum" : [ "recent", "old", "undefined", "unknown" ]
17
+ "s" : { "description" : "Value"},
18
+ "q" : { "description" : "Quality", "type" : "string", "enum" : [ "recent", "old", "undefined", "unknown"] }
19
+ },
20
+ "if": {
21
+ "properties": {
22
+ "q" : { "enum" : ["unknown","undefined"] }
23
+ }
24
+ },
25
+ "then": {
26
+ "properties": {
27
+ "s" : { "type" : "null" }
28
+ }
29
+ },
30
+ "else": {
31
+ "properties": {
32
+ "s" : { "type" : ["string","array"] }
22
33
  }
23
34
  },
24
35
  "required" : [ "sCI", "n", "s", "q" ],
@@ -0,0 +1,237 @@
1
+ # Format of SXL YAML Files
2
+ An RSMP SXL (Signal Exchange List) defines the messages that can be exchanged with a specific type of equipment, e.g. traffic light controllers.
3
+
4
+ Specifically, the SXL defines the alarms, statuses and commands and their attributes.
5
+
6
+ The SXL is the authoritative source for an SXL, and is used to generate documentation as well as JSON schema for automatic validation of message structure.
7
+ It's also used to generate configuratiosn for tools that cannot yert directly read the YAML format.
8
+
9
+
10
+ ```mermaid
11
+ graph LR
12
+ YAML --> Documentation
13
+ YAML --> Schema[JSON Schema]
14
+ YAML --> Tools[Tool Configurations]
15
+ ```
16
+
17
+ ## Structure
18
+ An SXL YAML contains a meta section, and a definition of the objects types included in the SXL:
19
+
20
+ ```
21
+ meta: Information about the SXL
22
+ objects: Definitions of objects types
23
+ Traffic Light Controller:
24
+ ...
25
+ Signal group:
26
+ ...
27
+ Detector logic
28
+ ...
29
+ ```
30
+
31
+ ### Meta Section
32
+ Includes descriptions of the SXL, like the name and version.
33
+
34
+ ```
35
+ meta:
36
+ name: Name of the schema
37
+ description: Description of the schema
38
+ version: Version of the schema
39
+ ```
40
+
41
+ ### Objects Section
42
+ Contains definitions of each object type in the SXL.
43
+ For each object type, there's a description, as well as definition of alarms, statuses and commands:
44
+
45
+ ```
46
+ objects:
47
+ Signal Group:
48
+ description: Description of the object
49
+ aggregated_status: Aggregated status definitions
50
+ ...
51
+ functional_position: Definition of functional position
52
+ functional_state: Definition of functional state
53
+ alarms: Alarm definitions
54
+ ...
55
+ statuses: Status definitions
56
+ ...
57
+ commands: Command definitions
58
+ ...
59
+ ...
60
+ ```
61
+ ### Aggregated Status Section
62
+ For each object type, the `aggregated_status:` section defines meaning of status bits 1-8:
63
+
64
+ ```
65
+ aggregated_status:
66
+ 1:
67
+ title: Name of status bit
68
+ description: Description of status bit
69
+ ...
70
+ 8:
71
+ title: Name of status bit
72
+ description: Description of status bit
73
+ ```
74
+
75
+ ### Functional Position and State
76
+ For each object type, the `functional_position:` and `functional_state:` define possible values.
77
+ If not used, `null` is specified.
78
+
79
+ ```
80
+ functional_position: List of possible values, or null if not used
81
+ functional_state: List of possible values, or null if not used
82
+ ```
83
+
84
+ ### Alarms Sections
85
+ For each object type, the `alarms:` section defines the alarms that can be send by that type of object.
86
+ The allowed alarm priorities and categories are defined in RSMP Core.
87
+
88
+ ```
89
+ A0001: Definition of alarm 1
90
+ description: Description of the alarm
91
+ priority: The alarm priority, either 1, 2 or 3
92
+ category: The alarm categery, either D or T
93
+ ```
94
+
95
+ ### Statuses Sections
96
+ For each object type, the `statuses:` section defines the alarms that can be send by that type of object.
97
+
98
+ ```
99
+ S0001: Definition of status 1
100
+ description: Description of the status
101
+ arguments: Definition of status arguments
102
+ ...
103
+ ```
104
+
105
+ Each argument contains a required description and a type. In addition it might contain other optional attributes that define
106
+ or restict how the argument is used.
107
+
108
+ ```
109
+ arguments:
110
+ speed:
111
+ description: Description of argument
112
+ type: Type of argument
113
+ ...
114
+ ...
115
+ ```
116
+
117
+ ### Commands Sections
118
+ For each object type, the `commands:` section defines the alarms that can be send to that type of object.
119
+ In addition it might contain other options used for validating the argument value.
120
+
121
+ ```
122
+ M001: Definition of command 1
123
+ description: Description of the command
124
+ arguments: Definition of command arguments
125
+ ...
126
+ ```
127
+
128
+ Each argument contains a required description and a type.
129
+ In addition it might contain other options used for validating the argument value.
130
+
131
+ ```
132
+ arguments:
133
+ speed:
134
+ description: Description of argument
135
+ type: Type of argument
136
+ ...
137
+ ...
138
+ ```
139
+
140
+ ### Argument options
141
+ Status and command argument definition might include options describing which values are valid for that argument.
142
+ These option can also be used for validating messages, e.g. by generating a JSON Schema.
143
+
144
+ #### description (Required)
145
+ A description of the argument
146
+
147
+ #### type (Required)
148
+ The type allowed for the argument. Possible values:
149
+
150
+ - string, a string, e.g. "start"
151
+ - integer: an integer send as a string, e.g. "6"
152
+ - boolean: a boolean send as a string, ether "true" or "false"
153
+ - base64: binary data encoded in base 64 format
154
+ - timestamp: a timestamp in the format "2025-06-08T08:05:06.584Z
155
+ - version: a semantic version string in the format "4.2.5"
156
+ - message_id: a message id in the format "be12ab9a-800c-4c19-8c50-adf832f22420"
157
+ - component_id: a string without further retrictions, e.g. "O+14439=481WA001"
158
+ - command_code: a command code in the format "M0001"
159
+ - status_code: a status code in the format "S0001"
160
+ - alarm_code: an alarm code in the format "A0001"
161
+ - string_list: a string with a command-separted list of items, e.g. "red,green,blue"
162
+ - integer_list: a string wih a comma-separated list of integers, e.g. "1,2,3"
163
+ - boolean_list: a string with a comma-separated list of booelans, e.g. "true,true,false"
164
+
165
+ #### values
166
+ A list of allowed enum values, defines as a hash of value/description.
167
+ The values can be either strings or integers:
168
+
169
+ Example:
170
+ ```yaml
171
+ values:
172
+ new: New priority request
173
+ update: Update to existing priority request
174
+ cancel: Cancel an existing priority
175
+ ```
176
+
177
+ #### min
178
+ Minimum value specified as an integer, e.g. 1.
179
+ Only allowed if the type is `integer`.
180
+
181
+ #### max
182
+ Maximum value specified as an integer, e.g. 255.
183
+ Only allowed if the type is `integer`.
184
+
185
+ #### pattern
186
+ A regular expression (regex) pattern used to validate the raw argument string, specified as a string, e.g. "^[01]*$".
187
+ Allowed regardless of the argument type.
188
+
189
+ ## Example Structure
190
+ Here is an example structure of an SXL YAML file:
191
+
192
+ ```yaml
193
+ meta:
194
+ name: tlc
195
+ description: Traffic Light Controllers
196
+ version: 1.0.15
197
+ objects:
198
+ Traffic Light Controller:
199
+ description: SXL for Traffic Light Controllers
200
+ aggregated_status:
201
+ 1:
202
+ title: Local mode
203
+ description: Traffic Light Controller is in local mode
204
+ ...
205
+ 8:
206
+ title: Not Connected
207
+ functional_position: null
208
+ functional_state: null
209
+ alarms:
210
+ A0001:
211
+ description: Serious hardware error
212
+ priority: 2
213
+ category: D
214
+ ...
215
+ statuses:
216
+ S0001:
217
+ description: Signal group status
218
+ arguments:
219
+ cyclecounter:
220
+ description: Cycle counter
221
+ type: integer
222
+ min: 0
223
+ max: 999
224
+ ...
225
+ ...
226
+ commands:
227
+ M0002:
228
+ description: Set current time plan
229
+ arguments:
230
+ timeplan:
231
+ description: Time plan number
232
+ type: integer
233
+ min: 1
234
+ max: 255
235
+ ...
236
+ ...
237
+ ```
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsmp_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Tin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2025-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_schemer
@@ -954,6 +954,7 @@ files:
954
954
  - schemas/tlc/1.2.1/statuses/S0208.json
955
955
  - schemas/tlc/1.2.1/statuses/statuses.json
956
956
  - schemas/tlc/1.2.1/sxl.yaml
957
+ - sxl_yaml_format.md
957
958
  homepage: https://github.com/rsmp-nordic/rsmp_schema
958
959
  licenses:
959
960
  - MIT
@@ -977,7 +978,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
977
978
  - !ruby/object:Gem::Version
978
979
  version: '0'
979
980
  requirements: []
980
- rubygems_version: 3.4.10
981
+ rubygems_version: 3.5.9
981
982
  signing_key:
982
983
  specification_version: 4
983
984
  summary: Validate RSMP message against RSMP JSON Schema.