{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "JSON schema for the Grunt Watch task",
    "definitions": {
        "target": {
            "properties": {
                "files": {
                    "description": "One or more files to watch.",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "tasks": {
                    "description": "One or more tasks to run.",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "options": {
                    "$ref": "#/definitions/options"
                }
            },
            "required": [
                "files"
            ]
        },
        "optionsWithEvents": {
            "oneOf": [
                {
                    "properties": {
                        "events": {
                            "description": "Specify the type watch event that trigger the specified task.",
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/eventType"
                            }
                        }
                    }
                },
                {
                    "properties": {
                        "events": {
                            "$ref": "#/definitions/eventType"
                        }
                    }
                }
            ]
        },
        "eventType": {
            "description": "Specify the type watch event that trigger the specified task.",
            "type": "string",
            "enum": [
                "all",
                "changed",
                "added",
                "deleted"
            ],
            "default": "all"
        },
        "options": {
            "description": "One or more files to watch.",
            "type": "object",
            "properties": {
                "spawn": {
                    "description": "Whether to spawn task runs in a child process.",
                    "type": "boolean",
                    "default": true
                },
                "interrupt": {
                    "description": "As files are modified this watch task will spawn tasks in child processes.",
                    "type": "boolean",
                    "default": false
                },
                "debounceDelay": {
                    "description": "How long to wait before emitting events in succession for the same filepath and status. For example if your Gruntfile.js file was changed, a 'changed' event will only fire again after the given milliseconds.",
                    "type": "integer",
                    "default": 500
                },
                "interval": {
                    "description": "The interval is passed to 'fs.watchFile'. Since 'interval' is only used by 'fs.watchFile' and this watcher also uses 'fs.watch'; it is recommended to ignore this option.",
                    "type": "integer",
                    "default": 100
                },
                "reload": {
                    "description": "By default, if Gruntfile.js is being watched, then changes to it will trigger the watch task to restart, and reload the Gruntfile.js changes. When reload is set to true, changes to any of the watched files will trigger the watch task to restart. This is especially useful if your Gruntfile.js is dependent on other files.",
                    "type": "boolean",
                    "default": false
                },
                "forever": {
                    "description": "This is only a task level option and cannot be configured per target. By default the watch task will duck punch grunt.fatal and grunt.warn to try and prevent them from exiting the watch process. If you don't want grunt.fatal and grunt.warn to be overridden set the forever option to false.",
                    "type": "boolean",
                    "default": true
                },
                "atBegin": {
                    "description": "This option will trigger the run of each specified task at startup of the watcher.",
                    "type": "boolean",
                    "default": false
                },
                "livereload": {
                    "description": "If enabled a live reload server will be started with the watch task per target. Then after the indicated tasks have run, the live reload server will be triggered with the modified files.",
                    "type": [
                        "boolean",
                        "number"
                    ],
                    "default": false
                },
                "cwd": {
                    "description": "Ability to set the current working directory.",
                    "type": [
                        "string",
                        "object"
                    ]
                },
                "livereloadOnError": {
                    "description": "Option to prevent the livereload if the executed tasks encountered an error. If set to  false , the livereload will only be triggered if all tasks completed successfully.",
                    "type": "boolean",
                    "default": true
                }
            },
            "allOf": [
                {
                    "$ref": "#/definitions/optionsWithEvents"
                }
            ]
        }
    },
    "type": "object",
    "properties": {
        "options": {
            "$ref": "#/definitions/options"
        }
    },
    "additionalProperties": {
        "$ref": "#/definitions/target"
    }
}