{
    "$schema": "http://json-schema.org/draft-04/schema",
    "definitions": {
        "nonEmptyString": {
            "type": "string",
            "minLength": 1
        },
        "multiString": {
            "anyOf": [
                {
                    "$ref": "#/definitions/nonEmptyString"
                },
                {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/nonEmptyString"
                    },
                    "_uniqueItems": true
                }
            ]
        }
    },
    "type": "object",
    "properties": {
        "name": {
            "$ref": "#/definitions/nonEmptyString"
        },
        "description": {
            "type": "string"
        },
        "namespace": {
            "$ref": "#/definitions/nonEmptyString"
        },
        "version": {
            "$ref": "#/definitions/nonEmptyString"
        },
        "downloadURL": {
            "$ref": "#/definitions/nonEmptyString"
        },
        "updateURL": {
            "$ref": "#/definitions/nonEmptyString"
        },
        "icon": {
            "$ref": "#/definitions/nonEmptyString"
        },
        "include": {
            "$ref": "#/definitions/multiString"
        },
        "exclude": {
            "$ref": "#/definitions/multiString"
        },
        "match": {
            "$ref": "#/definitions/multiString"
        },
        "require": {
            "$ref": "#/definitions/multiString"
        },
        "resource": {
            "$ref": "#/definitions/multiString"
        },
        "grant": {
            "anyOf": [
                {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "enum": [
                            "unsafeWindow",
                            "GM_getValue",
                            "GM_setValue",
                            "GM_listValues",
                            "GM_deleteValue",
                            "GM_getResourceText",
                            "GM_getResourceURL",
                            "GM_addStyle",
                            "GM_log",
                            "GM_openInTab",
                            "GM_registerMenuCommand",
                            "GM_setClipboard",
                            "GM_xmlhttpRequest"
                        ]
                    },
                    "_uniqueItems": true
                },
                {
                    "type": "string",
                    "enum": [
                        "none"
                    ]
                }
            ],
            "default": "none"
        },
        "run-at": {
            "type": "string",
            "enum": [
                "document-end",
                "document-start",
                "document-idle"
            ],
            "default": "document-end"
        },
        "noframes": {
            "type": "boolean",
            "default": false
        }
    },
    "additionalProperties": {
        "anyOf": [
            {
                "$ref": "#/definitions/multiString"
            },
            {
                "type": "boolean"
            }
        ]
    },
    "required": [
        "name",
        "namespace",
        "version"
    ]
}