schemas: legacy: extract Gpio

This allows to remove some properties from 'Aggregate' schema which are
no longer needed, since there is now a more specific schema to use.

Tested: Schema Validator Pass

Change-Id: I1638ef6247c54d88e4a5739daa584b541d3844a2
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/schemas/global.json b/schemas/global.json
index c03f32f..f822413 100644
--- a/schemas/global.json
+++ b/schemas/global.json
@@ -73,6 +73,9 @@
                             "$ref": "legacy.json#/$defs/I2CMux"
                         },
                         {
+                            "$ref": "legacy.json#/$defs/Gpio"
+                        },
+                        {
                             "$ref": "virtual_sensor.json#/$defs/VirtualSensor"
                         },
                         {
diff --git a/schemas/legacy.json b/schemas/legacy.json
index 47d37ee..444f339 100644
--- a/schemas/legacy.json
+++ b/schemas/legacy.json
@@ -367,6 +367,29 @@
             "required": ["Name", "Type", "Address", "Bus", "ChannelNames"],
             "type": "object"
         },
+        "Gpio": {
+            "additionalProperties": false,
+            "properties": {
+                "Name": {
+                    "$ref": "#/$defs/Types/Name"
+                },
+                "Index": {
+                    "$ref": "#/$defs/Types/Index"
+                },
+                "Direction": {
+                    "type": "string"
+                },
+                "Polarity": {
+                    "$ref": "#/$defs/Types/Polarity"
+                },
+                "Type": {
+                    "type": "string",
+                    "const": "Gpio"
+                }
+            },
+            "required": ["Name", "Type", "Index", "Direction", "Polarity"],
+            "type": "object"
+        },
         "Aggregate": {
             "description": "Don't add additional properties to this schema. Consult README.schema for instructions on adding new Exposes element sub-schema.",
             "additionalProperties": false,
@@ -427,9 +450,6 @@
                 "CurrScaleFactor": {
                     "$ref": "#/$defs/Types/CurrScaleFactor"
                 },
-                "Direction": {
-                    "$ref": "#/$defs/Types/Direction"
-                },
                 "EntityId": {
                     "$ref": "#/$defs/Types/EntityId"
                 },
@@ -466,9 +486,6 @@
                 "OffsetValue": {
                     "$ref": "#/$defs/Types/OffsetValue"
                 },
-                "Polarity": {
-                    "$ref": "#/$defs/Types/Polarity"
-                },
                 "Polling": {
                     "$ref": "#/$defs/Types/Polling"
                 },
@@ -801,7 +818,6 @@
                     "EEPROM",
                     "BMC",
                     "Board",
-                    "Gpio",
                     "pmbus",
                     "ADC128D818",
                     "INA230",