schema: factor out properties into legacy.json

The current Exposes element schema describes an object composed of
arbitrary properties from a list.  The list of allowed properties is
duplicated; there are already miscompares between the two - so factor
the list out, move it to a common place and reference the common list.

Further, schemas composed of arbitrary properties are too relaxed - more
descriptive schemas that restrict elements to better defined types is
conceiveable, so call the existing property list an "Aggregate" to
highlight its fuzzy nature, and move it to an isolated schema document
so we can add documentation that discourages adding new properties to
the Aggregate schema.

Change-Id: I97df88e0a40fd6fdf1d53b69e2855d31076fa09d
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/schemas/global.json b/schemas/global.json
index 3b870ad..b135a5c 100644
--- a/schemas/global.json
+++ b/schemas/global.json
@@ -9,138 +9,7 @@
                     "Exposes": {
                         "type": "array",
                         "items": {
-                            "type": "object",
-                            "properties": {
-                                "Address": {
-                                    "type": "string"
-                                },
-                                "Bus": {
-                                    "type": "string"
-                                },
-                                "Name": {
-                                    "type": "string"
-                                },
-                                "Type": {
-                                    "type": "string"
-                                },
-                                "ChannelNames": {
-                                    "type": "array",
-                                    "items": {
-                                        "type": "string"
-                                    }
-                                },
-                                "Class": {
-                                    "type": "string"
-                                },
-                                "FFGainCoefficient": {
-                                    "type": "number"
-                                },
-                                "FFOffCoefficient": {
-                                    "type": "number"
-                                },
-                                "ICoefficient": {
-                                    "type": "number"
-                                },
-                                "ILimitMax": {
-                                    "type": "number"
-                                },
-                                "ILimitMin": {
-                                    "type": "number"
-                                },
-                                "Inputs": {
-                                    "type": "array",
-                                    "items": {
-                                        "type": "string"
-                                    }
-                                },
-                                "NegativeHysteresis": {
-                                    "type": "number"
-                                },
-                                "OutLimitMax": {
-                                    "type": "number"
-                                },
-                                "OutLimitMin": {
-                                    "type": "number"
-                                },
-                                "Outputs": {
-                                    "type": "array",
-                                    "items": {
-                                        "type": "string"
-                                    }
-                                },
-                                "PCoefficient": {
-                                    "type": "number"
-                                },
-                                "PositiveHysteresis": {
-                                    "type": "number"
-                                },
-                                "SetPoint": {
-                                    "type": "number"
-                                },
-                                "SlewNeg": {
-                                    "type": "number"
-                                },
-                                "SlewPos": {
-                                    "type": "number"
-                                },
-                                "Zones": {
-                                    "type": "array",
-                                    "items": {
-                                        "type": "string"
-                                    }
-                                },
-                                "Thresholds": {
-                                    "type": "array",
-                                    "items": {
-                                        "type": "object",
-                                        "properties": {
-                                            "Direction": {
-                                                "type": "string"
-                                            },
-                                            "Name": {
-                                                "type": "string"
-                                            },
-                                            "Severity": {
-                                                "type": "number"
-                                            },
-                                            "Value": {
-                                                "type": "number"
-                                            },
-                                            "Label": {
-                                                "type": "string"
-                                            }
-                                        },
-                                        "required": [
-                                            "Direction",
-                                            "Name",
-                                            "Severity",
-                                            "Value"
-                                        ]
-                                    }
-                                },
-                                "Output": {
-                                    "type": "array",
-                                    "items": {
-                                        "type": "number"
-                                    }
-                                },
-                                "Reading": {
-                                    "type": "array",
-                                    "items": {
-                                        "type": "number"
-                                    }
-                                },
-                                "Labels": {
-                                    "type": "array",
-                                    "items": {
-                                        "type": "string"
-                                    }
-                                }
-                            },
-                            "required": [
-                                "Name",
-                                "Type"
-                            ]
+                            "$ref": "legacy.json#/definitions/Aggregate"
                         }
                     },
                     "Name": {
@@ -190,286 +59,7 @@
                 "Exposes": {
                     "type": "array",
                     "items": {
-                        "type": "object",
-                        "properties": {
-                            "Address": {
-                                "type": "string"
-                            },
-                            "Name": {
-                                "type": "string"
-                            },
-                            "Type": {
-                                "type": "string"
-                            },
-                            "Bus": {
-                                "type": [
-                                    "number",
-                                    "string"
-                                ]
-                            },
-                            "ChannelNames": {
-                                "type": "array",
-                                "items": {
-                                    "type": "string"
-                                }
-                            },
-                            "Class": {
-                                "type": "string"
-                            },
-                            "FFGainCoefficient": {
-                                "type": "number"
-                            },
-                            "FFOffCoefficient": {
-                                "type": "number"
-                            },
-                            "ICoefficient": {
-                                "type": "number"
-                            },
-                            "ILimitMax": {
-                                "type": "number"
-                            },
-                            "ILimitMin": {
-                                "type": "number"
-                            },
-                            "Inputs": {
-                                "type": "array",
-                                "items": {
-                                    "type": "string"
-                                }
-                            },
-                            "OutLimitMax": {
-                                "type": "number"
-                            },
-                            "OutLimitMin": {
-                                "type": "number"
-                            },
-                            "Outputs": {
-                                "type": "array",
-                                "items": {
-                                    "type": "string"
-                                }
-                            },
-                            "PCoefficient": {
-                                "type": "number"
-                            },
-                            "SetPoint": {
-                                "type": "number"
-                            },
-                            "SlewNeg": {
-                                "type": "number"
-                            },
-                            "SlewPos": {
-                                "type": "number"
-                            },
-                            "Zones": {
-                                "type": "array",
-                                "items": {
-                                    "type": "string"
-                                }
-                            },
-                            "Thresholds": {
-                                "type": "array",
-                                "items": {
-                                    "type": "object",
-                                    "properties": {
-                                        "Direction": {
-                                            "type": "string"
-                                        },
-                                        "Name": {
-                                            "type": "string"
-                                        },
-                                        "Severity": {
-                                            "type": "number"
-                                        },
-                                        "Value": {
-                                            "type": "number"
-                                        },
-                                        "Label": {
-                                            "type": "string"
-                                        }
-                                    },
-                                    "required": [
-                                        "Direction",
-                                        "Name",
-                                        "Severity",
-                                        "Value"
-                                    ]
-                                }
-                            },
-                            "Direction": {
-                                "type": "string"
-                            },
-                            "Index": {
-                                "type": "number"
-                            },
-                            "Polarity": {
-                                "type": "string"
-                            },
-                            "GpioPins": {
-                                "type": "array",
-                                "items": {
-                                    "type": "number"
-                                }
-                            },
-                            "ScaleFactor": {
-                                "type": "number"
-                            },
-                            "Connector": {
-                                "type": "object",
-                                "properties": {
-                                    "Name": {
-                                        "type": "string"
-                                    },
-                                    "Pwm": {
-                                        "type": "number"
-                                    },
-                                    "Tachs": {
-                                        "type": "array",
-                                        "items": {
-                                            "type": "number"
-                                        }
-                                    }
-                                },
-                                "required": [
-                                    "Name",
-                                    "Pwm",
-                                    "Tachs"
-                                ]
-                            },
-                            "FailSafePercent": {
-                                "type": "number"
-                            },
-                            "MinThermalOutput": {
-                                "type": "number"
-                            },
-                            "NegativeHysteresis": {
-                                "type": "number"
-                            },
-                            "Output": {
-                                "type": "array",
-                                "items": {
-                                    "type": "number"
-                                }
-                            },
-                            "PositiveHysteresis": {
-                                "type": "number"
-                            },
-                            "Reading": {
-                                "type": "array",
-                                "items": {
-                                    "type": "number"
-                                }
-                            },
-                            "Name1": {
-                                "type": "string"
-                            },
-                            "Labels": {
-                                "type": "array",
-                                "items": {
-                                    "type": "string"
-                                }
-                            },
-                            "CpuID": {
-                                "type": "number"
-                            },
-                            "DtsCritOffset": {
-                                "type": "number"
-                            },
-                            "BindConnector": {
-                                "type": "string"
-                            },
-                            "C1": {
-                                "type": "number"
-                            },
-                            "C2": {
-                                "type": "number"
-                            },
-                            "MaxCFM": {
-                                "type": "number"
-                            },
-                            "TachMaxPercent": {
-                                "type": "number"
-                            },
-                            "TachMinPercent": {
-                                "type": "number"
-                            },
-                            "Tachs": {
-                                "type": "array",
-                                "items": {
-                                    "type": [
-                                        "number",
-                                        "string"
-                                    ]
-                                }
-                            },
-                            "AlphaF": {
-                                "type": "number"
-                            },
-                            "AlphaS": {
-                                "type": "number"
-                            },
-                            "PowerFactorMax": {
-                                "type": "number"
-                            },
-                            "PowerFactorMin": {
-                                "type": "number"
-                            },
-                            "QMax": {
-                                "type": "number"
-                            },
-                            "QMin": {
-                                "type": "number"
-                            },
-                            "AllowedFailures": {
-                                "type": "number"
-                            },
-                            "Profiles": {
-                                "type": "array",
-                                "items": {
-                                    "type": "string"
-                                }
-                            },
-                            "BindPresence": {
-                                "type": "string"
-                            },
-                            "MaxReading": {
-                                "type": "number"
-                            },
-                            "PowerState": {
-                                "type": "string"
-                            },
-                            "BridgeGpio": {
-                                "type": "number"
-                            },
-                            "Status": {
-                                "type": "string"
-                            },
-                            "Pwm": {
-                                "type": "number"
-                            },
-                            "FaultIndex": {
-                                "type": "number"
-                            },
-                            "FaultType": {
-                                "type": "string"
-                            },
-                            "LedGpioPins": {
-                                "type": "array",
-                                "items": {
-                                    "type": "number"
-                                }
-                            },
-                            "SetPointOffset": {
-                                "type": "string"
-                            },
-                            "PresenceGpio": {
-                                "type": "number"
-                            }
-                        },
-                        "required": [
-                            "Name",
-                            "Type"
-                        ]
+                        "$ref": "legacy.json#/definitions/Aggregate"
                     }
                 },
                 "Name": {