{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Dependency manifest",
    "description": "This manifest declares dependency, and defines rules for updating its information",
    "definitions": {
        "detector": {
            "description": "Detector is a technique for updating information",
            "type": "object",
            "properties": {
                "xpath": {
                    "description": "XPath based detector",
                    "type": "object",
                    "properties": {
                        "url": {
                            "description": "Website URL",
                            "type": "string"
                        },
                        "xpath": {
                            "description": "XPath expression",
                            "type": "string"
                        },
                        "regex": {
                            "description": "Value parsing regular expression rule (value is specified by the single capture group)",
                            "type": "string"
                        }
                    },
                    "required": [
                        "url",
                        "xpath"
                    ]
                },
                "maven": {
                    "description": "Maven based detector",
                    "type": "object",
                    "properties": {
                        "repository": {
                            "description": "Base URL of the Maven repository",
                            "type": "string"
                        },
                        "xpath": {
                            "description": "XPath expression for the Maven repository metadata XML",
                            "type": "string"
                        },
                        "dateFormat": {
                            "description": "Date parsing format (default: %Y%m%d%H%M%S)",
                            "type": "string"
                        }
                    }
                }
            },
            "maxProperties": 1,
            "minProperties": 1
        },
        "variable": {
            "description": "Variable",
            "type": "object",
            "properties": {
                "name": {
                    "description": "Variable name",
                    "type": "string"
                },
                "value": {
                    "description": "Variable value",
                    "type": "string"
                }
            },
            "required": [
                "name",
                "value"
            ]
        }
    },
    "type": "object",
    "properties": {
        "extends": {
            "description": "Template manifest settings",
            "type": "object",
            "properties": {
                "template": {
                    "description": "Template name",
                    "type": "string"
                },
                "vars": {
                    "description": "Variables to be passed to the template",
                    "type": "array",
                    "items": {
                        "description": "Variable",
                        "$ref": "#/definitions/variable"
                    }
                }
            },
            "required": [
                "template"
            ]
        },
        "name": {
            "description": "Dependency name",
            "type": "string"
        },
        "license": {
            "description": "Dependency license",
            "type": "string"
        },
        "pages": {
            "description": "Various Web pages URLs",
            "type": "object",
            "properties": {
                "home": {
                    "description": "Official homepage URL",
                    "type": "string"
                },
                "download": {
                    "description": "Download page",
                    "type": "string"
                },
                "license": {
                    "description": "License page",
                    "type": "string"
                },
                "docs": {
                    "description": "Documentation page",
                    "type": "string"
                },
                "changelist": {
                    "description": "Changelog page",
                    "type": "string"
                },
                "issues": {
                    "description": "Issue Tracker page",
                    "type": "string"
                }
            },
            "required": [
                "home"
            ]
        },
        "detectors": {
            "description": "Techniques for detecting dependency updates",
            "type": "object",
            "properties": {
                "version": {
                    "description": "Latest version detector",
                    "$ref": "#/definitions/detector"
                },
                "updatetime": {
                    "description": "Latest update date detector",
                    "$ref": "#/definitions/detector"
                },
                "changelist": {
                    "description": "Latest version changelist detector",
                    "$ref": "#/definitions/detector"
                },
                "license": {
                    "description": "License name detector",
                    "$ref": "#/definitions/detector"
                },
                "url": {
                    "description": "Official homepage URL detector",
                    "$ref": "#/definitions/detector"
                },
                "description": {
                    "description": "Dependency description detector",
                    "$ref": "#/definitions/detector"
                }
            },
            "required": [
                "version"
            ]
        },
        "aliases": {
            "description": "Dependency aliases",
            "type": "array",
            "items": {
                "description": "Alias name",
                "type": "string"
            }
        }
    },
    "anyOf": [
        {
            "title": "'name' and 'extends' are required",
            "required": [
                "name",
                "extends"
            ]
        },
        {
            "title": "'name', 'pages' and 'detectors' are required",
            "required": [
                "name",
                "pages",
                "detectors"
            ]
        }
    ]
}