rsmp_schemer 0.3.1 → 0.4.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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +10 -9
  3. data/lib/rsmp_schemer/version.rb +1 -1
  4. data/rsmp_schemer.gemspec +1 -1
  5. data/schemas/core_3.1.2/schema/core/alarm.json +8 -4
  6. data/schemas/core_3.1.2/spec/core/alarm_spec.rb +15 -0
  7. data/schemas/core_3.1.4/.gitignore +1 -0
  8. data/schemas/core_3.1.4/schema/core/alarm.json +8 -4
  9. data/schemas/core_3.1.4/spec/core/alarm_spec.rb +15 -0
  10. data/schemas/core_3.1.4/spec/core/version_spec.rb +3 -2
  11. data/schemas/core_3.1.5/.gitignore +1 -0
  12. data/schemas/core_3.1.5/schema/core/alarm.json +40 -41
  13. data/schemas/core_3.1.5/schema/core/alarm_issue.json +44 -0
  14. data/schemas/core_3.1.5/schema/core/alarm_suspend_resume.json +3 -0
  15. data/schemas/core_3.1.5/schema/core/alarm_suspended_resumed.json +47 -0
  16. data/schemas/core_3.1.5/schema/core/command_response.json +1 -1
  17. data/schemas/core_3.1.5/schema/core/status_response.json +1 -1
  18. data/schemas/core_3.1.5/schema/core/status_update.json +1 -1
  19. data/schemas/core_3.1.5/spec/core/alarm_issue_spec.rb +299 -0
  20. data/schemas/core_3.1.5/spec/core/alarm_resume_spec.rb +93 -0
  21. data/schemas/core_3.1.5/spec/core/alarm_resumed_spec.rb +277 -0
  22. data/schemas/core_3.1.5/spec/core/alarm_suspend_spec.rb +93 -0
  23. data/schemas/core_3.1.5/spec/core/alarm_suspended_spec.rb +277 -0
  24. data/schemas/core_3.1.5/spec/core/version_spec.rb +3 -2
  25. data/schemas/tlc_1.0.13/schema/tlc/statuses/S0023.json +1 -1
  26. data/schemas/tlc_1.0.13/spec/tlc/S0023_spec.rb +96 -0
  27. data/schemas/tlc_1.0.14/schema/tlc/statuses/S0023.json +1 -1
  28. data/schemas/tlc_1.0.14/spec/tlc/S0023_spec.rb +96 -0
  29. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0023.json +1 -1
  30. data/schemas/tlc_1.0.15/spec/tlc/S0023_spec.rb +96 -0
  31. metadata +18 -11
  32. data/schemas/core_3.1.2/examples/validate.rb +0 -35
  33. data/schemas/core_3.1.4/examples/validate.rb +0 -35
  34. data/schemas/core_3.1.4/spec/core/alarm_request_spec.rb +0 -72
  35. data/schemas/core_3.1.5/examples/validate.rb +0 -35
  36. data/schemas/core_3.1.5/spec/core/alarm_request_spec.rb +0 -72
  37. data/schemas/core_3.1.5/spec/core/alarm_spec.rb +0 -298
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d922949f9fd92682d6f3af16ddebbb63c339724b397ced40ddc3406493f3853
4
- data.tar.gz: 92185faeffff9f0c2be6178cf784baf171e8bf9897a2e6a89407cceb25612133
3
+ metadata.gz: 82a864ad0c18ba82e9aed1074af548dac54e6a0e396cb2d7b567cf0bec629c24
4
+ data.tar.gz: 7fb5c1565865a0833e8a555131e46e604d93a20e5c118218abb95b6c8730541c
5
5
  SHA512:
6
- metadata.gz: 7dfdee34f17658596adee8541f650e6fa018f3aa1571c50c019d0944c100465e775baed876bf9d855b1830e5198f7cf2cc0cec810b73113b53e215ada168230c
7
- data.tar.gz: 9278d033f5ed1b1f7211b8e5392bf8c1b2ed2e364abb0b1f39715adba339c9b3b6ac48b1dc342783b0523080e0e2a1b40d3e959492e1a49b14e2ec9611baf7db
6
+ metadata.gz: b36b9110c2c9cad63986e2bb8979f875cff92675abc989b77bb021ae159bb271f9d818258f1d3187c8461e90392cde2cb2221a4f9566d221c39ce20bf809f7a0
7
+ data.tar.gz: 9c0f371915fac4a32f8fa2cc4795aab5ce86864283facc15426911fd3e23d90c6e6cc974b76f853d8b4d671e834d97a0981e83d4ebda1a724c6d3ec3753f0909
data/Gemfile.lock CHANGED
@@ -1,23 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp_schemer (0.3.1)
5
- json_schemer (~> 0.2.18)
4
+ rsmp_schemer (0.4.1)
5
+ json_schemer (~> 0.2.21)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- diff-lcs (1.4.4)
11
- ecma-re-validator (0.3.0)
12
- regexp_parser (~> 2.0)
10
+ diff-lcs (1.5.0)
11
+ ecma-re-validator (0.4.0)
12
+ regexp_parser (~> 2.2)
13
13
  hana (1.3.7)
14
- json_schemer (0.2.18)
14
+ json_schemer (0.2.21)
15
15
  ecma-re-validator (~> 0.3)
16
16
  hana (~> 1.3)
17
17
  regexp_parser (~> 2.0)
18
18
  uri_template (~> 0.7)
19
- rake (13.0.3)
20
- regexp_parser (2.1.1)
19
+ rake (13.0.6)
20
+ regexp_parser (2.5.0)
21
21
  rspec (3.9.0)
22
22
  rspec-core (~> 3.9.0)
23
23
  rspec-expectations (~> 3.9.0)
@@ -35,6 +35,7 @@ GEM
35
35
 
36
36
  PLATFORMS
37
37
  x86_64-darwin-20
38
+ x86_64-darwin-21
38
39
 
39
40
  DEPENDENCIES
40
41
  rake (~> 13.0)
@@ -43,4 +44,4 @@ DEPENDENCIES
43
44
  rspec-expectations (~> 3.9.1)
44
45
 
45
46
  BUNDLED WITH
46
- 2.2.15
47
+ 2.3.5
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RSMP
4
4
  module Schemer
5
- VERSION = "0.3.1"
5
+ VERSION = "0.4.1"
6
6
  end
7
7
  end
data/rsmp_schemer.gemspec CHANGED
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
39
39
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
40
40
  spec.require_paths = ["lib"]
41
41
 
42
- spec.add_dependency "json_schemer", "~> 0.2.18"
42
+ spec.add_dependency "json_schemer", "~> 0.2.21"
43
43
 
44
44
  spec.add_development_dependency "rspec", "~> 3.9.0"
45
45
  spec.add_development_dependency "rspec-expectations", "~> 3.9.1"
@@ -9,22 +9,26 @@
9
9
  "aSp" : {
10
10
  "description" : "Alarm message variant",
11
11
  "type" : "string",
12
- "enum" : [ "Issue", "Acknowledge", "Suspend", "Resume" ]
12
+ "enum" : [ "Issue", "Acknowledge", "Suspend", "Resume",
13
+ "issue", "acknowledge", "suspend", "resume" ]
13
14
  },
14
15
  "ack" : {
15
16
  "description" : "Acknowledgement",
16
17
  "type" : "string",
17
- "enum" : [ "Acknowledged", "notAcknowledged" ]
18
+ "enum" : [ "Acknowledged", "notAcknowledged",
19
+ "acknowledged", "NotAcknowledged" ]
18
20
  },
19
21
  "aS" : {
20
22
  "description" : "Status",
21
23
  "type" : "string",
22
- "enum" : [ "inActive", "Active" ]
24
+ "enum" : [ "inActive", "Active",
25
+ "InActive", "active" ]
23
26
  },
24
27
  "sS" : {
25
28
  "description" : "Suspended",
26
29
  "type" : "string",
27
- "enum" : [ "suspended", "notSuspended" ]
30
+ "enum" : [ "suspended", "notSuspended",
31
+ "Suspended", "NotSuspended" ]
28
32
  },
29
33
  "aTs" : { "$ref": "definitions.json#/timestamp" },
30
34
  "cat" : {
@@ -89,6 +89,21 @@ RSpec.describe "Traffic Light Controller RSMP SXL Schema validation" do
89
89
  ])
90
90
  end
91
91
 
92
+ it 'accept states with first letter in lowercase' do
93
+ invalid = message.dup
94
+ invalid['aSp'] = "issue"
95
+ expect( validate(invalid) ).to be_nil
96
+
97
+ invalid['aSp'] = "acknowledge"
98
+ expect( validate(invalid) ).to be_nil
99
+
100
+ invalid['aSp'] = "suspend"
101
+ expect( validate(invalid) ).to be_nil
102
+
103
+ invalid['aSp'] = "resume"
104
+ expect( validate(invalid) ).to be_nil
105
+ end
106
+
92
107
  it 'catches wrong state type' do
93
108
  invalid = message.dup
94
109
  invalid['aSp'] = 123
@@ -0,0 +1 @@
1
+ .DS_Store
@@ -9,22 +9,26 @@
9
9
  "aSp" : {
10
10
  "description" : "Alarm message variant",
11
11
  "type" : "string",
12
- "enum" : [ "Issue", "Acknowledge", "Suspend", "Resume" ]
12
+ "enum" : [ "Issue", "Acknowledge", "Suspend", "Resume",
13
+ "issue", "acknowledge", "suspend", "resume" ]
13
14
  },
14
15
  "ack" : {
15
16
  "description" : "Acknowledgement",
16
17
  "type" : "string",
17
- "enum" : [ "Acknowledged", "notAcknowledged" ]
18
+ "enum" : [ "Acknowledged", "notAcknowledged",
19
+ "acknowledged", "NotAcknowledged" ]
18
20
  },
19
21
  "aS" : {
20
22
  "description" : "Status",
21
23
  "type" : "string",
22
- "enum" : [ "inActive", "Active" ]
24
+ "enum" : [ "inActive", "Active",
25
+ "InActive", "active" ]
23
26
  },
24
27
  "sS" : {
25
28
  "description" : "Suspended",
26
29
  "type" : "string",
27
- "enum" : [ "suspended", "notSuspended" ]
30
+ "enum" : [ "suspended", "notSuspended",
31
+ "Suspended", "NotSuspended" ]
28
32
  },
29
33
  "aTs" : { "$ref": "definitions.json#/timestamp" },
30
34
  "cat" : {
@@ -89,6 +89,21 @@ RSpec.describe "Traffic Light Controller RSMP SXL Schema validation" do
89
89
  ])
90
90
  end
91
91
 
92
+ it 'accept states with first letter in lowercase' do
93
+ invalid = message.dup
94
+ invalid['aSp'] = "issue"
95
+ expect( validate(invalid) ).to be_nil
96
+
97
+ invalid['aSp'] = "acknowledge"
98
+ expect( validate(invalid) ).to be_nil
99
+
100
+ invalid['aSp'] = "suspend"
101
+ expect( validate(invalid) ).to be_nil
102
+
103
+ invalid['aSp'] = "resume"
104
+ expect( validate(invalid) ).to be_nil
105
+ end
106
+
92
107
  it 'catches wrong state type' do
93
108
  invalid = message.dup
94
109
  invalid['aSp'] = 123
@@ -10,9 +10,10 @@ RSpec.describe "Traffic Light Controller RSMP SXL Schema validation" do
10
10
  { "vers" => "3.1.1" },
11
11
  { "vers" => "3.1.2" },
12
12
  { "vers" => "3.1.3" },
13
- { "vers" => "3.1.4" }
13
+ { "vers" => "3.1.4" },
14
+ { "vers" => "3.1.5" }
14
15
  ],
15
- "SXL" => "1.1"
16
+ "SXL" => "1.0.15"
16
17
  }}
17
18
 
18
19
  it 'accepts valid message' do
@@ -0,0 +1 @@
1
+ .DS_Store
@@ -7,49 +7,48 @@
7
7
  "aCId" : { "$ref": "definitions.json#/alarm_code" },
8
8
  "xACId" : { "description" : "External alarm code id", "type" : "string" },
9
9
  "aSp" : {
10
- "description" : "Alarm message variant",
10
+ "description" : "Alarm specialization",
11
11
  "type" : "string",
12
- "enum" : [ "Issue", "Acknowledge", "Suspend", "Resume", "Request" ]
13
- },
14
- "ack" : {
15
- "description" : "Acknowledgement",
16
- "type" : "string",
17
- "enum" : [ "Acknowledged", "notAcknowledged" ]
18
- },
19
- "aS" : {
20
- "description" : "Status",
21
- "type" : "string",
22
- "enum" : [ "inActive", "Active" ]
23
- },
24
- "sS" : {
25
- "description" : "Suspended",
26
- "type" : "string",
27
- "enum" : [ "suspended", "notSuspended" ]
28
- },
29
- "aTs" : { "$ref": "definitions.json#/timestamp" },
30
- "cat" : {
31
- "description" : "Category",
32
- "type" : "string",
33
- "enum" : [ "T", "D" ]
12
+ "enum" : [ "Issue", "Acknowledge", "Suspend", "Resume", "Request",
13
+ "issue", "acknowledge", "suspend", "resume", "request" ]
14
+ }
15
+ },
16
+ "required" : [ "aSp"],
17
+ "allOf" : [
18
+ {
19
+ "if": {
20
+ "required" : [ "aSp" ],
21
+ "properties" : { "aSp" : { "const" : "Issue" } }
22
+ },
23
+ "then": { "$ref": "alarm_issue.json" }
34
24
  },
35
- "pri" : {
36
- "description" : "Priority",
37
- "type" : "string",
38
- "enum" : [ "1", "2", "3" ]
25
+ {
26
+ "if": {
27
+ "allOf" : [
28
+ {
29
+ "required" : [ "aSp" ],
30
+ "properties" : {
31
+ "aSp" : { "enum" : [ "Suspend","Resume",
32
+ "suspend", "resume"] }
33
+ }
34
+ },
35
+ {
36
+ "not": { "required" : [ "sS" ] }
37
+ }
38
+ ]
39
+ },
40
+ "then": { "$ref": "alarm_suspend_resume.json" }
39
41
  },
40
- "rvs" : {
41
- "description" : "Return values",
42
- "type" : "array",
43
- "items" : {
44
- "type" : "object",
45
- "properties": {
46
- "n" : { "description" : "Unique reference of the value", "type" : "string" },
47
- "v" : { "description" : "Value", "type" : "string" }
48
- },
49
- "required" : [ "n", "v" ],
50
- "additionProperties": false
51
- }
42
+ {
43
+ "if": {
44
+ "required" : [ "aSp", "sS" ],
45
+ "properties" : {
46
+ "aSp" : { "const" : "Suspend" },
47
+ "sS" : { "enum" : [ "suspended", "notSuspended",
48
+ "Suspended", "NotSuspended" ] }
49
+ }
50
+ },
51
+ "then": { "$ref": "alarm_suspended_resumed.json" }
52
52
  }
53
- },
54
- "required" : [ "mId", "cId", "aCId", "xACId", "aSp", "ack", "aS", "aTs", "sS", "cat", "pri", "rvs" ]
53
+ ]
55
54
  }
@@ -0,0 +1,44 @@
1
+ {
2
+ "properties" : {
3
+ "ack" : {
4
+ "description" : "Acknowledgement",
5
+ "type" : "string",
6
+ "enum" : [ "Acknowledged", "notAcknowledged" ]
7
+ },
8
+ "aS" : {
9
+ "description" : "Active status",
10
+ "type" : "string",
11
+ "enum" : [ "inActive", "Active" ]
12
+ },
13
+ "sS" : {
14
+ "description" : "Suspend status",
15
+ "type" : "string",
16
+ "enum" : [ "suspended", "notSuspended" ]
17
+ },
18
+ "aTs" : { "$ref": "definitions.json#/timestamp" },
19
+ "cat" : {
20
+ "description" : "Category",
21
+ "type" : "string",
22
+ "enum" : [ "T", "D" ]
23
+ },
24
+ "pri" : {
25
+ "description" : "Priority",
26
+ "type" : "string",
27
+ "enum" : [ "1", "2", "3" ]
28
+ },
29
+ "rvs" : {
30
+ "description" : "Return values",
31
+ "type" : "array",
32
+ "items" : {
33
+ "type" : "object",
34
+ "properties": {
35
+ "n" : { "description" : "Unique reference of the value", "type" : "string" },
36
+ "v" : { "description" : "Value", "type" : "string" }
37
+ },
38
+ "required" : [ "n", "v" ],
39
+ "additionalProperties": false
40
+ }
41
+ }
42
+ },
43
+ "required" : [ "mId", "cId", "aCId", "xACId", "aSp", "ack", "aS", "aTs", "sS", "cat", "pri", "rvs" ]
44
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "required" : [ "mId", "cId", "aCId", "xACId", "aSp" ]
3
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "properties" : {
3
+ "ack" : {
4
+ "description" : "Acknowledgement",
5
+ "type" : "string",
6
+ "enum" : [ "Acknowledged", "notAcknowledged",
7
+ "acknowledged", "NotAcknowledged" ]
8
+ },
9
+ "aS" : {
10
+ "description" : "Active status",
11
+ "type" : "string",
12
+ "enum" : [ "inActive", "Active",
13
+ "InActive", "active" ]
14
+ },
15
+ "sS" : {
16
+ "description" : "Suspend status",
17
+ "type" : "string",
18
+ "enum" : [ "suspended", "notSuspended",
19
+ "Suspended", "NotSuspended" ]
20
+ },
21
+ "aTs" : { "$ref": "definitions.json#/timestamp" },
22
+ "cat" : {
23
+ "description" : "Category",
24
+ "type" : "string",
25
+ "enum" : [ "T", "D" ]
26
+ },
27
+ "pri" : {
28
+ "description" : "Priority",
29
+ "type" : "string",
30
+ "enum" : [ "1", "2", "3" ]
31
+ },
32
+ "rvs" : {
33
+ "description" : "Return values",
34
+ "type" : "array",
35
+ "items" : {
36
+ "type" : "object",
37
+ "properties": {
38
+ "n" : { "description" : "Unique reference of the value", "type" : "string" },
39
+ "v" : { "description" : "Value", "type" : "string" }
40
+ },
41
+ "required" : [ "n", "v" ],
42
+ "additionalProperties": false
43
+ }
44
+ }
45
+ },
46
+ "required" : [ "mId", "cId", "aCId", "xACId", "aSp", "ack", "aS", "aTs", "sS", "cat", "pri", "rvs" ]
47
+ }
@@ -26,7 +26,7 @@
26
26
  }
27
27
  },
28
28
  "required" : [ "cCI", "n", "v", "age" ],
29
- "additionProperties": false
29
+ "additionalProperties": false
30
30
  }
31
31
  }
32
32
  },
@@ -22,7 +22,7 @@
22
22
  }
23
23
  },
24
24
  "required" : [ "sCI", "n", "s", "q" ],
25
- "additionProperties": false
25
+ "additionalProperties": false
26
26
  }
27
27
  }
28
28
  },
@@ -22,7 +22,7 @@
22
22
  }
23
23
  },
24
24
  "required" : [ "sCI", "n", "s", "q" ],
25
- "additionProperties": false
25
+ "additionalProperties": false
26
26
  }
27
27
  }
28
28
  },