{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "JSON schema for JSONPatch files",
    "definitions": {
        "operation": {
            "type": "object",
            "required": [
                "op",
                "path"
            ],
            "allOf": [
                {
                    "$ref": "#/definitions/path"
                }
            ],
            "oneOf": [
                {
                    "properties": {
                        "op": {
                            "description": "The operation to perform.",
                            "type": "string",
                            "enum": [
                                "add",
                                "replace",
                                "test"
                            ]
                        },
                        "value": {
                            "description": "The value to add, replace or test."
                        }
                    },
                    "required": [
                        "value"
                    ]
                },
                {
                    "properties": {
                        "op": {
                            "description": "The operation to perform.",
                            "type": "string",
                            "enum": [
                                "remove"
                            ]
                        }
                    }
                },
                {
                    "properties": {
                        "op": {
                            "description": "The operation to perform.",
                            "type": "string",
                            "enum": [
                                "move",
                                "copy"
                            ]
                        },
                        "from": {
                            "description": "A JSON Pointer path pointing to the locatoin to move/copy from.",
                            "type": "string"
                        }
                    },
                    "required": [
                        "from"
                    ]
                }
            ]
        },
        "path": {
            "properties": {
                "path": {
                    "description": "A JSON Pointer path.",
                    "type": "string"
                }
            }
        }
    },
    "type": "array",
    "items": {
        "$ref": "#/definitions/operation"
    }
}