{
    "title": "JSON schema for express-json-patch-assertion options",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "allow": {
            "description": "Assertions that will allow matched operations to proceed",
            "oneOf": [
                {
                    "$ref": "#/definitions/assertion"
                },
                {
                    "$ref": "#/definitions/assertionList"
                }
            ]
        },
        "deny": {
            "description": "Assertions that will deny matched operations from proceeding",
            "oneOf": [
                {
                    "$ref": "#/definitions/assertion"
                },
                {
                    "$ref": "#/definitions/assertionList"
                }
            ]
        },
        "property": {
            "type": "string",
            "minLenth": 1
        },
        "ajv": {
            "$ref": "#/definitions/ajvOptions"
        }
    },
    "required": [
        "allow",
        "deny",
        "property",
        "ajv"
    ],
    "definitions": {
        "assertion": {
            "type": "object",
            "allOf": [
                {
                    "$ref": "#/definitions/path"
                },
                {
                    "$ref": "#/definitions/op"
                }
            ],
            "properties": {
                "condition": {
                    "type": "object"
                },
                "assertion": {
                    "description": "Whether to proceed to next middleware if this one is matched"
                },
                "next": {
                    "description": "Whether to proceed to next middleware if this one is matched",
                    "type": "boolean"
                },
                "value": {
                    "description": "Value or pattern to match against this operation"
                },
                "from": {
                    "description": "Property to copy or move from",
                    "type": "string"
                }
            },
            "required": [
                "path",
                "op"
            ]
        },
        "assertionList": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/assertion"
            }
        },
        "path": {
            "properties": {
                "path": {
                    "oneOf": [
                        {
                            "$ref": "#/definitions/pathString"
                        },
                        {
                            "$ref": "#/definitions/pathList"
                        }
                    ]
                }
            }
        },
        "pathString": {
            "description": "A JSON Pointer path.",
            "type": "string"
        },
        "pathList": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/pathString"
            }
        },
        "op": {
            "properties": {
                "op": {
                    "oneOf": [
                        {
                            "$ref": "#/definitions/opString"
                        },
                        {
                            "$ref": "#/definitions/opList"
                        }
                    ]
                }
            }
        },
        "opString": {
            "type": "string",
            "enum": [
                "add",
                "replace",
                "test",
                "remove",
                "*"
            ]
        },
        "opList": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/opString"
            }
        },
        "ajvOptions": {
            "description": "AJV json validator options - see https://github.com/epoberezkin/ajv/blob/master/README.md#options",
            "type": "object"
        }
    }
}