From c0349426579f667980c7101336b45944db231f83 Mon Sep 17 00:00:00 2001 From: David Otterdahl Date: Thu, 6 Jul 2023 18:32:02 +0200 Subject: [PATCH 1/5] Fix malformed YAML --- schemas/tlc/1.1/sxl.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/schemas/tlc/1.1/sxl.yaml b/schemas/tlc/1.1/sxl.yaml index c054aa0..355943c 100644 --- a/schemas/tlc/1.1/sxl.yaml +++ b/schemas/tlc/1.1/sxl.yaml @@ -1888,8 +1888,9 @@ objects: type: string description: Detector forced on/off while detector error values: - 'on': # on/off must be quoted, otherwise they are converted to true/false - 'off': + # on/off must be quoted, otherwise they are converted to true/false + 'on': '' + 'off': '' manual: type: boolean description: Manually controlled detector logic (True/False) From 456782eddbfc8ec7f1ec0df5ce5a47d4399026a9 Mon Sep 17 00:00:00 2001 From: David Otterdahl Date: Fri, 7 Jul 2023 09:29:58 +0200 Subject: [PATCH 2/5] Revert "Fix malformed YAML" This reverts commit c0349426579f667980c7101336b45944db231f83. --- schemas/tlc/1.1/sxl.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/schemas/tlc/1.1/sxl.yaml b/schemas/tlc/1.1/sxl.yaml index 355943c..c054aa0 100644 --- a/schemas/tlc/1.1/sxl.yaml +++ b/schemas/tlc/1.1/sxl.yaml @@ -1888,9 +1888,8 @@ objects: type: string description: Detector forced on/off while detector error values: - # on/off must be quoted, otherwise they are converted to true/false - 'on': '' - 'off': '' + 'on': # on/off must be quoted, otherwise they are converted to true/false + 'off': manual: type: boolean description: Manually controlled detector logic (True/False) From 13d1691522aa4d7cceb07ec318998b8948185e28 Mon Sep 17 00:00:00 2001 From: David Otterdahl Date: Fri, 7 Jul 2023 09:32:10 +0200 Subject: [PATCH 3/5] Define 'on'/'off' consistently --- schemas/tlc/1.1/sxl.yaml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/schemas/tlc/1.1/sxl.yaml b/schemas/tlc/1.1/sxl.yaml index c054aa0..537c7c4 100644 --- a/schemas/tlc/1.1/sxl.yaml +++ b/schemas/tlc/1.1/sxl.yaml @@ -1887,9 +1887,8 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': # on/off must be quoted, otherwise they are converted to true/false - 'off': + # on/off must be quoted, otherwise they are parsed as true/false + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) @@ -1913,9 +1912,8 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + # on/off must be quoted, otherwise they are parsed as true/false + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) @@ -1945,7 +1943,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - # note that on and off must be quoted, otherwise they are parsed as true and false + # on/off must be quoted, otherwise they are parsed as true/false values: ['on','off'] manual: type: boolean @@ -1970,6 +1968,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error + # on/off must be quoted, otherwise they are parsed as true/false values: ['on','off'] manual: type: boolean From 436b200e29a72667f3850c9a61c9c8a3d379084f Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Fri, 7 Jul 2023 09:33:53 +0200 Subject: [PATCH 4/5] use array for on/off enums, show error if an enum hash has empty values --- lib/rsmp_schema/convert/export/json_schema.rb | 5 +++++ schemas/tlc/1.0.10/sxl.yaml | 8 ++------ schemas/tlc/1.0.13/sxl.yaml | 8 ++------ schemas/tlc/1.0.14/sxl.yaml | 8 ++------ schemas/tlc/1.0.15/sxl.yaml | 8 ++------ schemas/tlc/1.0.7/sxl.yaml | 8 ++------ schemas/tlc/1.0.8/sxl.yaml | 8 ++------ schemas/tlc/1.0.9/sxl.yaml | 8 ++------ schemas/tlc/1.1/sxl.yaml | 7 ++++++- 9 files changed, 25 insertions(+), 43 deletions(-) diff --git a/lib/rsmp_schema/convert/export/json_schema.rb b/lib/rsmp_schema/convert/export/json_schema.rb index 431d814..2f366cb 100644 --- a/lib/rsmp_schema/convert/export/json_schema.rb +++ b/lib/rsmp_schema/convert/export/json_schema.rb @@ -110,6 +110,11 @@ def self.handle_enum item, out if item["values"] out["enum"] = case item["values"] when Hash + item["values"].each_pair do |k,v| + if v=='' or v==nil + raise "Error: '#{k}' has empty value in #{item}. (When using a hash to specify 'values', the hash values cannot be empty.)" + end + end item["values"].keys.sort when Array item["values"].sort diff --git a/schemas/tlc/1.0.10/sxl.yaml b/schemas/tlc/1.0.10/sxl.yaml index e18e6de..34928fe 100644 --- a/schemas/tlc/1.0.10/sxl.yaml +++ b/schemas/tlc/1.0.10/sxl.yaml @@ -857,9 +857,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) @@ -884,9 +882,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) diff --git a/schemas/tlc/1.0.13/sxl.yaml b/schemas/tlc/1.0.13/sxl.yaml index 0d0488f..d96f75b 100644 --- a/schemas/tlc/1.0.13/sxl.yaml +++ b/schemas/tlc/1.0.13/sxl.yaml @@ -1159,9 +1159,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) @@ -1186,9 +1184,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) diff --git a/schemas/tlc/1.0.14/sxl.yaml b/schemas/tlc/1.0.14/sxl.yaml index b443cc0..e516623 100644 --- a/schemas/tlc/1.0.14/sxl.yaml +++ b/schemas/tlc/1.0.14/sxl.yaml @@ -1297,9 +1297,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) @@ -1324,9 +1322,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) diff --git a/schemas/tlc/1.0.15/sxl.yaml b/schemas/tlc/1.0.15/sxl.yaml index 6b83cd8..fd3b153 100644 --- a/schemas/tlc/1.0.15/sxl.yaml +++ b/schemas/tlc/1.0.15/sxl.yaml @@ -1436,9 +1436,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) @@ -1463,9 +1461,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) diff --git a/schemas/tlc/1.0.7/sxl.yaml b/schemas/tlc/1.0.7/sxl.yaml index feb7bf4..bbadedb 100644 --- a/schemas/tlc/1.0.7/sxl.yaml +++ b/schemas/tlc/1.0.7/sxl.yaml @@ -828,9 +828,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) @@ -855,9 +853,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) diff --git a/schemas/tlc/1.0.8/sxl.yaml b/schemas/tlc/1.0.8/sxl.yaml index 1a7b091..e9662ee 100644 --- a/schemas/tlc/1.0.8/sxl.yaml +++ b/schemas/tlc/1.0.8/sxl.yaml @@ -857,9 +857,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) @@ -884,9 +882,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) diff --git a/schemas/tlc/1.0.9/sxl.yaml b/schemas/tlc/1.0.9/sxl.yaml index 0b461b1..6df9954 100644 --- a/schemas/tlc/1.0.9/sxl.yaml +++ b/schemas/tlc/1.0.9/sxl.yaml @@ -857,9 +857,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) @@ -884,9 +882,7 @@ objects: errormode: type: string description: Detector forced on/off while detector error - values: - 'on': '' - 'off': '' + values: ['on','off'] manual: type: boolean description: Manually controlled detector logic (True/False) diff --git a/schemas/tlc/1.1/sxl.yaml b/schemas/tlc/1.1/sxl.yaml index 537c7c4..e60d41b 100644 --- a/schemas/tlc/1.1/sxl.yaml +++ b/schemas/tlc/1.1/sxl.yaml @@ -1887,7 +1887,10 @@ objects: errormode: type: string description: Detector forced on/off while detector error +<<<<<<< HEAD # on/off must be quoted, otherwise they are parsed as true/false +======= +>>>>>>> 59e99c4 (use array for on/off enums, show error if an enum hash has empty values) values: ['on','off'] manual: type: boolean @@ -1912,7 +1915,10 @@ objects: errormode: type: string description: Detector forced on/off while detector error +<<<<<<< HEAD # on/off must be quoted, otherwise they are parsed as true/false +======= +>>>>>>> 59e99c4 (use array for on/off enums, show error if an enum hash has empty values) values: ['on','off'] manual: type: boolean @@ -1943,7 +1949,6 @@ objects: errormode: type: string description: Detector forced on/off while detector error - # on/off must be quoted, otherwise they are parsed as true/false values: ['on','off'] manual: type: boolean From 514b7e861b372d22659dbdbfe0f6b51ed92065a4 Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Fri, 7 Jul 2023 09:45:14 +0200 Subject: [PATCH 5/5] fix merge left-overs --- schemas/tlc/1.1/sxl.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/schemas/tlc/1.1/sxl.yaml b/schemas/tlc/1.1/sxl.yaml index e60d41b..23edb2a 100644 --- a/schemas/tlc/1.1/sxl.yaml +++ b/schemas/tlc/1.1/sxl.yaml @@ -1887,10 +1887,6 @@ objects: errormode: type: string description: Detector forced on/off while detector error -<<<<<<< HEAD - # on/off must be quoted, otherwise they are parsed as true/false -======= ->>>>>>> 59e99c4 (use array for on/off enums, show error if an enum hash has empty values) values: ['on','off'] manual: type: boolean @@ -1915,10 +1911,6 @@ objects: errormode: type: string description: Detector forced on/off while detector error -<<<<<<< HEAD - # on/off must be quoted, otherwise they are parsed as true/false -======= ->>>>>>> 59e99c4 (use array for on/off enums, show error if an enum hash has empty values) values: ['on','off'] manual: type: boolean