leak detector: json schema definition
Define the json schema for leak detector and use it in expose elements
in global.json schema. The leak detector schema defines various
properties such as type, subtype, gpio pin name, gpio polarity, etc as
per design https://gerrit.openbmc.org/c/openbmc/docs/+/73152.
Related PR:
https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/75999
Change-Id: I82f674a982d57774f3616cf0064256f8feadf158
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/meson.build b/meson.build
index fc77e8a..d476f60 100644
--- a/meson.build
+++ b/meson.build
@@ -112,6 +112,7 @@
'stepwise.json',
'virtual_sensor.json',
'satellite_controller.json',
+ 'leak_detector.json',
]
foreach s : schemas
diff --git a/schemas/global.json b/schemas/global.json
index 070f794..e9bc310 100644
--- a/schemas/global.json
+++ b/schemas/global.json
@@ -38,6 +38,9 @@
"$ref": "virtual_sensor.json#/$defs/VirtualSensor"
},
{
+ "$ref": "leak_detector.json#/$defs/GPIOLeakDetector"
+ },
+ {
"description": "Ensure the parent anyOf schema does not validate when an element does not define a type property.",
"not": {
"required": ["Type"]
diff --git a/schemas/leak_detector.json b/schemas/leak_detector.json
new file mode 100644
index 0000000..d37531a
--- /dev/null
+++ b/schemas/leak_detector.json
@@ -0,0 +1,43 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$defs": {
+ "GPIOLeakDetector": {
+ "description": "Configuration for GPIO based Leak Detector.",
+ "type": "object",
+ "properties": {
+ "Name": {
+ "description": "The name of the leak detector.",
+ "type": "string"
+ },
+ "Type": {
+ "description": "The type of configuration object",
+ "type": "string"
+ },
+ "SubType": {
+ "description": "The type of leak detector.",
+ "enum": ["LeakSensingCable", "Unknown"]
+ },
+ "PinName": {
+ "description": "The GPIO pin name for the leak detector.",
+ "type": "string"
+ },
+ "Polarity": {
+ "description": "The GPIO polarity depicting its active status.",
+ "enum": ["ActiveLow", "ActiveHigh"]
+ },
+ "Level": {
+ "description": "The severity level of the leak detector.",
+ "enum": ["Critical", "Warning"]
+ }
+ },
+ "required": [
+ "Name",
+ "Type",
+ "SubType",
+ "PinName",
+ "Polarity",
+ "Level"
+ ]
+ }
+ }
+}