GPIO valve: add configuration schema

Add configuration schema for GPIO based valve where the valve's open
status is depicted by a GPIO. This configuration will be consumed by
ValveMonitor service which will be added to dbus-sensors repository.

Change-Id: I5f6640886a4393e403fc1714e2cd239870bae6ef
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/schemas/exposes_record.json b/schemas/exposes_record.json
index ead34d8..9196b54 100644
--- a/schemas/exposes_record.json
+++ b/schemas/exposes_record.json
@@ -170,6 +170,9 @@
                 },
                 {
                     "$ref": "modbus.json#/$defs/ModbusRTUDetect"
+                },
+                {
+                    "$ref": "valve.json#/$defs/GPIOValve"
                 }
             ]
         },
diff --git a/schemas/meson.build b/schemas/meson.build
index fb8821b..1dc345e 100644
--- a/schemas/meson.build
+++ b/schemas/meson.build
@@ -20,5 +20,6 @@
     'stepwise.json',
     'topology.json',
     'usb_port.json',
+    'valve.json',
     'virtual_sensor.json',
 ]
diff --git a/schemas/valve.json b/schemas/valve.json
new file mode 100644
index 0000000..53969b2
--- /dev/null
+++ b/schemas/valve.json
@@ -0,0 +1,44 @@
+{
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "$defs": {
+        "GPIOValve": {
+            "additionalProperties": false,
+            "description": "Configuration for GPIO based Valve.",
+            "type": "object",
+            "properties": {
+                "Name": {
+                    "description": "The name of the valve.",
+                    "type": "string"
+                },
+                "Type": {
+                    "description": "The type of configuration object",
+                    "const": "GPIOValve"
+                },
+                "OpenPinName": {
+                    "description": "The name of the GPIO pin that shows the valve's open status.",
+                    "type": "string"
+                },
+                "OpenPolarity": {
+                    "description": "The GPIO polarity depicting valve's open status.",
+                    "$ref": "legacy.json#/$defs/Types/Polarity"
+                },
+                "OpenControlPinName": {
+                    "description": "The name of the GPIO pin that controls opening the valve.",
+                    "type": "string"
+                },
+                "OpenControlValue": {
+                    "description": "The GPIO value to set to open the valve.",
+                    "type": "boolean"
+                }
+            },
+            "required": [
+                "Name",
+                "Type",
+                "OpenPinName",
+                "OpenPolarity",
+                "OpenControlPinName",
+                "OpenControlValue"
+            ]
+        }
+    }
+}