{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "additionalProperties": false,
    "type": "object",
    "definitions": {
        "_typeSet": {
            "title": "Type",
            "enum": [
                "set"
            ]
        },
        "_typeRemove": {
            "title": "Type",
            "enum": [
                "remove"
            ]
        },
        "_typeMove": {
            "title": "Type",
            "enum": [
                "move"
            ]
        },
        "_typeCopy": {
            "title": "Type",
            "enum": [
                "copy"
            ]
        },
        "destination": {
            "title": "Destination",
            "description": "JSON path to place result",
            "type": "string",
            "minLength": 1
        },
        "source": {
            "title": "Source",
            "description": "JSON path of source value",
            "type": "string",
            "minLength": 1
        },
        "valueTemplate": {
            "title": "Value Template",
            "type": "string",
            "minLength": 1
        }
    },
    "properties": {
        "rules": {
            "title": "Rules",
            "type": "array",
            "minItems": 1,
            "items": {
                "title": "Rule",
                "type": "object",
                "oneOf": [
                    {
                        "properties": {
                            "type": {
                                "$ref": "#/definitions/_typeSet"
                            },
                            "destination": {
                                "$ref": "#/definitions/destination"
                            },
                            "valueTemplate": {
                                "$ref": "#/definitions/valueTemplate"
                            }
                        },
                        "required": [
                            "type",
                            "destination",
                            "valueTemplate"
                        ],
                        "additionalProperties": false
                    },
                    {
                        "properties": {
                            "type": {
                                "$ref": "#/definitions/_typeRemove"
                            },
                            "source": {
                                "$ref": "#/definitions/source"
                            }
                        },
                        "required": [
                            "type",
                            "source"
                        ],
                        "additionalProperties": false
                    },
                    {
                        "properties": {
                            "type": {
                                "$ref": "#/definitions/_typeMove"
                            },
                            "destination": {
                                "$ref": "#/definitions/destination"
                            },
                            "source": {
                                "$ref": "#/definitions/source"
                            }
                        },
                        "required": [
                            "type",
                            "destination",
                            "source"
                        ],
                        "additionalProperties": false
                    },
                    {
                        "properties": {
                            "type": {
                                "$ref": "#/definitions/_typeCopy"
                            },
                            "destination": {
                                "$ref": "#/definitions/destination"
                            },
                            "source": {
                                "$ref": "#/definitions/source"
                            }
                        },
                        "required": [
                            "type",
                            "destination",
                            "source"
                        ],
                        "additionalProperties": false
                    }
                ]
            }
        }
    },
    "required": [
        "rules"
    ]
}