Config/schema_config.json

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "required": ["name", "description", "counters"],
    "properties": {
        "name": {
            "type": "string",
            "description": "Name of the configuration"
        },
        "description": {
            "type": "string",
            "description": "Description of what this configuration monitors"
        },
        "counters": {
            "type": "array",
            "minItems": 1,
            "items": {
                "type": "object",
                "required": [
                    "title",
                    "unit",
                    "conversionFactor",
                    "conversionExponent",
                    "conversionType",
                    "decimalPlaces",
                    "format",
                    "counterID",
                    "counterSetType",
                    "counterInstance",
                    "colorMap",
                    "graphConfiguration"
                ],
                "properties": {
                    "title": {
                        "type": "string"
                    },
                    "unit": {
                        "type": "string"
                    },
                    "conversionFactor": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "conversionExponent": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "conversionType": {
                        "type": "string",
                        "enum": ["D", "M"]
                    },
                    "decimalPlaces": {
                        "type": "integer",
                        "minimum": 0
                    },
                    "format": {
                        "type": "string",
                        "enum": ["both", "table", "graph"]
                    },
                    "counterID": {
                        "type": "string",
                        "pattern": "^\\d+-\\d+$"
                    },
                    "counterSetType": {
                        "type": "string",
                        "enum": ["SingleInstance", "MultiInstance"]
                    },
                    "counterInstance": {
                        "type": "string"
                    },
                    "colorMap": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "string"
                        },
                        "propertyNames": {
                            "pattern": "^\\d+(\\.\\d+)?$"
                        }
                    },
                    "graphConfiguration": {
                        "type": "object",
                        "required": [
                            "Samples",
                            "graphType",
                            "showStatistics",
                            "yAxisStep",
                            "yAxisMaxRows",
                            "colors"
                        ],
                        "properties": {
                            "Samples": {
                                "type": "integer",
                                "minimum": 70
                            },
                            "graphType": {
                                "type": "string",
                                "enum": ["Bar", "Line", "Scatter"]
                            },
                            "showStatistics": {
                                "type": "boolean"
                            },
                            "yAxisStep": {
                                "type": "number",
                                "minimum": 1
                            },
                            "yAxisMaxRows": {
                                "type": "integer",
                                "minimum": 10
                            },
                            "colors": {
                                "type": "object",
                                "required": ["title", "statistics", "default"],
                                "properties": {
                                    "title": {
                                        "type": "string"
                                    },
                                    "statistics": {
                                        "type": "string"
                                    },
                                    "default": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "if": {
                    "properties": {
                        "counterSetType": { "const": "SingleInstance" }
                    }
                },
                "then": {
                    "properties": {
                        "counterInstance": { "const": "" }
                    }
                },
                "else": {
                    "properties": {
                        "counterInstance": {
                            "type": "string",
                            "minLength": 1,
                            "pattern": "^[^|]+(\\|[^|]+)*$"
                        }
                    }
                }
            }
        }
    }
}