{
    "definitions": {
        "formula": {
            "properties": {
                "equation": {
                    "type": "string"
                },
                "variables": {
                    "minProperties": 1,
                    "patternProperties": {
                        "^.+$": {
                            "$ref": "#/definitions/variable"
                        }
                    },
                    "type": "object"
                }
            },
            "required": [
                "equation",
                "variables"
            ],
            "type": "object"
        },
        "metric": {
            "properties": {
                "classification": {
                    "type": "string"
                },
                "dataType": {
                    "enum": [
                        "count",
                        "percentage",
                        "numeric",
                        "integer",
                        "time"
                    ],
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "devices": {
                    "oneOf": [
                        {
                            "$ref": "#/definitions/stringArray"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "displayName": {
                    "type": "string"
                },
                "formula": {
                    "$ref": "#/definitions/formula"
                },
                "max": {
                    "type": [
                        "string",
                        "number",
                        "null"
                    ]
                },
                "min": {
                    "type": [
                        "string",
                        "number",
                        "null"
                    ]
                },
                "notes": {
                    "type": "string"
                },
                "platforms": {
                    "type": "object"
                },
                "refs": {
                    "$ref": "#/definitions/stringArray"
                },
                "sigFigs": {
                    "oneOf": [
                        {
                            "$ref": "#/definitions/positiveInteger"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "type": {
                    "enum": [
                        "raw",
                        "derived"
                    ],
                    "type": "string"
                },
                "units": {
                    "type": [
                        "string",
                        "null"
                    ]
                }
            },
            "required": [
                "displayName",
                "units",
                "max",
                "min",
                "sigFigs",
                "dataType",
                "type",
                "formula",
                "description",
                "notes",
                "platforms",
                "devices",
                "classification",
                "refs"
            ],
            "type": "object"
        },
        "positiveInteger": {
            "minimum": 0,
            "type": "integer"
        },
        "stringArray": {
            "items": {
                "type": "string"
            },
            "minItems": 1,
            "type": "array",
            "_uniqueItems": true
        },
        "variable": {
            "properties": {
                "description": {
                    "type": "string"
                }
            },
            "required": [
                "description"
            ],
            "type": "object"
        }
    },
    "description": "Schema for doc-metrix metric documentation.",
    "minProperties": 1,
    "patternProperties": {
        "^.+$": {
            "$ref": "#/definitions/metric"
        }
    },
    "type": "object"
}