schema: use pid, zone, stepwise schemas

These schemas were defined, but not referenced anywhere.  Use them, and
remove the duplicated properties from the legacy aggregate schema.

Change-Id: I75ba8099059127cfa5c2d6492908333ca5c3bf67
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/schemas/Pid.Zone.json b/schemas/Pid.Zone.json
index 86ff1e1..4e4e41a 100644
--- a/schemas/Pid.Zone.json
+++ b/schemas/Pid.Zone.json
@@ -1,24 +1,28 @@
 {
-    "$schema": "http://json-schema.org/schema#",
-    "type": "object",
-    "properties": {
-        "FailSafePercent": {
-            "type": "number"
-        },
-        "MinThermalOutput": {
-            "type": "number"
-        },
-        "Name": {
-            "type": "string"
-        },
-        "Type": {
-            "type": "string"
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "definitions": {
+        "PidZone": {
+            "type": "object",
+            "properties": {
+                "FailSafePercent": {
+                    "type": "number"
+                },
+                "MinThermalOutput": {
+                    "type": "number"
+                },
+                "Name": {
+                    "type": "string"
+                },
+                "Type": {
+                    "type": "string"
+                }
+            },
+            "required": [
+                "FailSafePercent",
+                "MinThermalOutput",
+                "Name",
+                "Type"
+            ]
         }
-    },
-    "required": [
-        "FailSafePercent",
-        "MinThermalOutput",
-        "Name",
-        "Type"
-    ]
+    }
 }
diff --git a/schemas/Pid.json b/schemas/Pid.json
index 862496d..06c31fa 100644
--- a/schemas/Pid.json
+++ b/schemas/Pid.json
@@ -1,92 +1,96 @@
 {
-    "$schema": "http://json-schema.org/schema#",
-    "type": "object",
-    "properties": {
-        "Class": {
-            "type": "string"
-        },
-        "FFGainCoefficient": {
-            "type": "number"
-        },
-        "FFOffCoefficient": {
-            "type": "number"
-        },
-        "ICoefficient": {
-            "type": "number"
-        },
-        "ILimitMax": {
-            "type": "number"
-        },
-        "ILimitMin": {
-            "type": "number"
-        },
-        "Inputs": {
-            "type": "array",
-            "items": {
-                "type": "string"
-            }
-        },
-        "Name": {
-            "type": "string"
-        },
-        "OutLimitMax": {
-            "type": "number"
-        },
-        "OutLimitMin": {
-            "type": "number"
-        },
-        "Outputs": {
-            "type": "array",
-            "items": {
-                "type": "string"
-            }
-        },
-        "PCoefficient": {
-            "type": "number"
-        },
-        "Profiles": {
-            "type": "array",
-            "items": {
-                "type": "string"
-            }
-        },
-        "SlewNeg": {
-            "type": "number"
-        },
-        "SlewPos": {
-            "type": "number"
-        },
-        "Type": {
-            "type": "string"
-        },
-        "Zones": {
-            "type": "array",
-            "items": {
-                "type": "string"
-            }
-        },
-        "SetPoint": {
-            "type": "number"
-        },
-        "SetPointOffset": {
-            "type": "string"
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "definitions": {
+        "Pid": {
+            "type": "object",
+            "properties": {
+                "Class": {
+                    "type": "string"
+                },
+                "FFGainCoefficient": {
+                    "type": "number"
+                },
+                "FFOffCoefficient": {
+                    "type": "number"
+                },
+                "ICoefficient": {
+                    "type": "number"
+                },
+                "ILimitMax": {
+                    "type": "number"
+                },
+                "ILimitMin": {
+                    "type": "number"
+                },
+                "Inputs": {
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                },
+                "Name": {
+                    "type": "string"
+                },
+                "OutLimitMax": {
+                    "type": "number"
+                },
+                "OutLimitMin": {
+                    "type": "number"
+                },
+                "Outputs": {
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                },
+                "PCoefficient": {
+                    "type": "number"
+                },
+                "Profiles": {
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                },
+                "SlewNeg": {
+                    "type": "number"
+                },
+                "SlewPos": {
+                    "type": "number"
+                },
+                "Type": {
+                    "type": "string"
+                },
+                "Zones": {
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                },
+                "SetPoint": {
+                    "type": "number"
+                },
+                "SetPointOffset": {
+                    "type": "string"
+                }
+            },
+            "required": [
+                "Class",
+                "FFGainCoefficient",
+                "FFOffCoefficient",
+                "ICoefficient",
+                "ILimitMax",
+                "ILimitMin",
+                "Inputs",
+                "Name",
+                "OutLimitMax",
+                "OutLimitMin",
+                "PCoefficient",
+                "SlewNeg",
+                "SlewPos",
+                "Type",
+                "Zones"
+            ]
         }
-    },
-    "required": [
-        "Class",
-        "FFGainCoefficient",
-        "FFOffCoefficient",
-        "ICoefficient",
-        "ILimitMax",
-        "ILimitMin",
-        "Inputs",
-        "Name",
-        "OutLimitMax",
-        "OutLimitMin",
-        "PCoefficient",
-        "SlewNeg",
-        "SlewPos",
-        "Type",
-        "Zones"
-    ]
+    }
 }
diff --git a/schemas/Stepwise.json b/schemas/Stepwise.json
index e6814ff..1111af8 100644
--- a/schemas/Stepwise.json
+++ b/schemas/Stepwise.json
@@ -1,62 +1,66 @@
 {
-    "$schema": "http://json-schema.org/schema#",
-    "type": "object",
-    "properties": {
-        "Class": {
-            "type": "string"
-        },
-        "Inputs": {
-            "type": "array",
-            "items": {
-                "type": "string"
-            }
-        },
-        "Name": {
-            "type": "string"
-        },
-        "NegativeHysteresis": {
-            "type": "number"
-        },
-        "Output": {
-            "type": "array",
-            "items": {
-                "type": "number"
-            }
-        },
-        "PositiveHysteresis": {
-            "type": "number"
-        },
-        "Profiles": {
-            "type": "array",
-            "items": {
-                "type": "string"
-            }
-        },
-        "Reading": {
-            "type": "array",
-            "items": {
-                "type": "number"
-            }
-        },
-        "Type": {
-            "type": "string"
-        },
-        "Zones": {
-            "type": "array",
-            "items": {
-                "type": "string"
-            }
+    "$schema": "http://json-schema.org/draft-07/schema#",
+    "definitions": {
+        "Stepwise": {
+            "type": "object",
+            "properties": {
+                "Class": {
+                    "type": "string"
+                },
+                "Inputs": {
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                },
+                "Name": {
+                    "type": "string"
+                },
+                "NegativeHysteresis": {
+                    "type": "number"
+                },
+                "Output": {
+                    "type": "array",
+                    "items": {
+                        "type": "number"
+                    }
+                },
+                "PositiveHysteresis": {
+                    "type": "number"
+                },
+                "Profiles": {
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                },
+                "Reading": {
+                    "type": "array",
+                    "items": {
+                        "type": "number"
+                    }
+                },
+                "Type": {
+                    "type": "string"
+                },
+                "Zones": {
+                    "type": "array",
+                    "items": {
+                        "type": "string"
+                    }
+                }
+            },
+            "required": [
+                "Class",
+                "Inputs",
+                "Name",
+                "NegativeHysteresis",
+                "Output",
+                "PositiveHysteresis",
+                "Reading",
+                "Type",
+                "Zones"
+            ]
         }
-    },
-    "required": [
-        "Class",
-        "Inputs",
-        "Name",
-        "NegativeHysteresis",
-        "Output",
-        "PositiveHysteresis",
-        "Reading",
-        "Type",
-        "Zones"
-    ]
+    }
 }
diff --git a/schemas/global.json b/schemas/global.json
index eb1af51..ee49869 100644
--- a/schemas/global.json
+++ b/schemas/global.json
@@ -9,6 +9,15 @@
             ],
             "oneOf": [
                 {
+                    "$ref": "Pid.json#/definitions/Pid"
+                },
+                {
+                    "$ref": "Pid.Zone.json#/definitions/PidZone"
+                },
+                {
+                    "$ref": "Stepwise.json#/definitions/Stepwise"
+                },
+                {
                     "$ref": "legacy.json#/definitions/Aggregate"
                 },
                 {
diff --git a/schemas/legacy.json b/schemas/legacy.json
index 69d7a19..8ac0515 100644
--- a/schemas/legacy.json
+++ b/schemas/legacy.json
@@ -63,15 +63,6 @@
                 "DtsCritOffset": {
                     "$ref": "#/definitions/Types/DtsCritOffset"
                 },
-                "FFGainCoefficient": {
-                    "$ref": "#/definitions/Types/FFGainCoefficient"
-                },
-                "FFOffCoefficient": {
-                    "$ref": "#/definitions/Types/FFOffCoefficient"
-                },
-                "FailSafePercent": {
-                    "$ref": "#/definitions/Types/FailSafePercent"
-                },
                 "FaultIndex": {
                     "$ref": "#/definitions/Types/FaultIndex"
                 },
@@ -84,21 +75,9 @@
                 "GpioPolarity": {
                     "$ref": "#/definitions/Types/GpioPolarity"
                 },
-                "ICoefficient": {
-                    "$ref": "#/definitions/Types/ICoefficient"
-                },
-                "ILimitMax": {
-                    "$ref": "#/definitions/Types/ILimitMax"
-                },
-                "ILimitMin": {
-                    "$ref": "#/definitions/Types/ILimitMin"
-                },
                 "Index": {
                     "$ref": "#/definitions/Types/Index"
                 },
-                "Inputs": {
-                    "$ref": "#/definitions/Types/Inputs"
-                },
                 "Labels": {
                     "$ref": "#/definitions/Types/Labels"
                 },
@@ -111,45 +90,21 @@
                 "MaxReading": {
                     "$ref": "#/definitions/Types/MaxReading"
                 },
-                "MinThermalOutput": {
-                    "$ref": "#/definitions/Types/MinThermalOutput"
-                },
                 "Name": {
                     "$ref": "#/definitions/Types/Name"
                 },
                 "Name1": {
                     "$ref": "#/definitions/Types/Name1"
                 },
-                "NegativeHysteresis": {
-                    "$ref": "#/definitions/Types/NegativeHysteresis"
-                },
                 "OffsetValue": {
                     "$ref": "#/definitions/Types/OffsetValue"
                 },
-                "OutLimitMax": {
-                    "$ref": "#/definitions/Types/OutLimitMax"
-                },
-                "OutLimitMin": {
-                    "$ref": "#/definitions/Types/OutLimitMin"
-                },
-                "Output": {
-                    "$ref": "#/definitions/Types/Output"
-                },
-                "Outputs": {
-                    "$ref": "#/definitions/Types/Outputs"
-                },
-                "PCoefficient": {
-                    "$ref": "#/definitions/Types/PCoefficient"
-                },
                 "Polarity": {
                     "$ref": "#/definitions/Types/Polarity"
                 },
                 "Polling": {
                     "$ref": "#/definitions/Types/Polling"
                 },
-                "PositiveHysteresis": {
-                    "$ref": "#/definitions/Types/PositiveHysteresis"
-                },
                 "PowerFactorMax": {
                     "$ref": "#/definitions/Types/PowerFactorMax"
                 },
@@ -168,9 +123,6 @@
                 "PresenceGpio": {
                     "$ref": "#/definitions/Types/PresenceGpio"
                 },
-                "Profiles": {
-                    "$ref": "#/definitions/Types/Profiles"
-                },
                 "Pwm": {
                     "$ref": "#/definitions/Types/Pwm"
                 },
@@ -180,9 +132,6 @@
                 "QMin": {
                     "$ref": "#/definitions/Types/QMin"
                 },
-                "Reading": {
-                    "$ref": "#/definitions/Types/Reading"
-                },
                 "RedundantCount": {
                     "$ref": "#/definitions/Types/RedundantCount"
                 },
@@ -195,18 +144,6 @@
                 "SensorType": {
                     "$ref": "#/definitions/Types/SensorType"
                 },
-                "SetPoint": {
-                    "$ref": "#/definitions/Types/SetPoint"
-                },
-                "SetPointOffset": {
-                    "$ref": "#/definitions/Types/SetPointOffset"
-                },
-                "SlewNeg": {
-                    "$ref": "#/definitions/Types/SlewNeg"
-                },
-                "SlewPos": {
-                    "$ref": "#/definitions/Types/SlewPos"
-                },
                 "Status": {
                     "$ref": "#/definitions/Types/Status"
                 },
@@ -224,9 +161,6 @@
                 },
                 "Type": {
                     "$ref": "#/definitions/Types/Type"
-                },
-                "Zones": {
-                    "$ref": "#/definitions/Types/Zones"
                 }
             },
             "required": [
@@ -321,15 +255,6 @@
             "DtsCritOffset": {
                 "type": "number"
             },
-            "FFGainCoefficient": {
-                "type": "number"
-            },
-            "FFOffCoefficient": {
-                "type": "number"
-            },
-            "FailSafePercent": {
-                "type": "number"
-            },
             "FaultIndex": {
                 "type": "number"
             },
@@ -347,24 +272,9 @@
                     "Low"
                 ]
             },
-            "ICoefficient": {
-                "type": "number"
-            },
-            "ILimitMax": {
-                "type": "number"
-            },
-            "ILimitMin": {
-                "type": "number"
-            },
             "Index": {
                 "type": "number"
             },
-            "Inputs": {
-                "items": {
-                    "type": "string"
-                },
-                "type": "array"
-            },
             "Labels": {
                 "items": {
                     "type": "string"
@@ -383,51 +293,21 @@
             "MaxReading": {
                 "type": "number"
             },
-            "MinThermalOutput": {
-                "type": "number"
-            },
             "Name": {
                 "type": "string"
             },
             "Name1": {
                 "type": "string"
             },
-            "NegativeHysteresis": {
-                "type": "number"
-            },
             "OffsetValue": {
                 "type": "number"
             },
-            "OutLimitMax": {
-                "type": "number"
-            },
-            "OutLimitMin": {
-                "type": "number"
-            },
-            "Output": {
-                "items": {
-                    "type": "number"
-                },
-                "type": "array"
-            },
-            "Outputs": {
-                "items": {
-                    "type": "string"
-                },
-                "type": "array"
-            },
-            "PCoefficient": {
-                "type": "number"
-            },
             "Polarity": {
                 "type": "string"
             },
             "Polling": {
                 "type": "object"
             },
-            "PositiveHysteresis": {
-                "type": "number"
-            },
             "PowerFactorMax": {
                 "type": "number"
             },
@@ -457,12 +337,6 @@
                     "array"
                 ]
             },
-            "Profiles": {
-                "items": {
-                    "type": "string"
-                },
-                "type": "array"
-            },
             "Pwm": {
                 "type": "number"
             },
@@ -472,12 +346,6 @@
             "QMin": {
                 "type": "number"
             },
-            "Reading": {
-                "items": {
-                    "type": "number"
-                },
-                "type": "array"
-            },
             "RedundantCount": {
                 "type": "number"
             },
@@ -490,18 +358,6 @@
             "SensorType": {
                 "type": "string"
             },
-            "SetPoint": {
-                "type": "number"
-            },
-            "SetPointOffset": {
-                "type": "string"
-            },
-            "SlewNeg": {
-                "type": "number"
-            },
-            "SlewPos": {
-                "type": "number"
-            },
             "Status": {
                 "type": "string"
             },
@@ -551,12 +407,6 @@
             },
             "Type": {
                 "type": "string"
-            },
-            "Zones": {
-                "items": {
-                    "type": "string"
-                },
-                "type": "array"
             }
         }
     }