{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "definitions": {
        "_methodNoBody": {
            "title": "HTTP Method",
            "description": "GET, DELETE, POST, PATCH or PUT",
            "enum": [
                "GET",
                "DELETE"
            ]
        },
        "_methodWithBody": {
            "title": "HTTP Method",
            "description": "GET, DELETE, POST, PATCH or PUT",
            "enum": [
                "POST",
                "PATCH",
                "PUT"
            ]
        },
        "responsePath": {
            "title": "Response Path",
            "description": "JSON path for where to store response",
            "type": "string",
            "minLength": 1
        },
        "uriTemplate": {
            "title": "URI Template",
            "minLength": 1,
            "type": "string",
            "messages": {
                "required": "URI Template is required"
            }
        },
        "bodyTemplate": {
            "title": "Request Body",
            "type": "string"
        },
        "headerInfo": {
            "type": "array",
            "items": {
                "additionalProperties": false,
                "type": "object",
                "properties": {
                    "key": {
                        "title": "Name",
                        "type": "string",
                        "minLength": 1
                    },
                    "valueTemplate": {
                        "title": "Value Template",
                        "type": "string",
                        "minLength": 1
                    }
                },
                "required": [
                    "key",
                    "valueTemplate"
                ]
            }
        }
    },
    "oneOf": [
        {
            "properties": {
                "method": {
                    "$ref": "#/definitions/_methodNoBody"
                },
                "responsePath": {
                    "$ref": "#/definitions/responsePath"
                },
                "uriTemplate": {
                    "$ref": "#/definitions/uriTemplate"
                },
                "headerInfo": {
                    "$ref": "#/definitions/headerInfo"
                }
            },
            "required": [
                "method",
                "uriTemplate"
            ],
            "additionalProperties": false
        },
        {
            "properties": {
                "method": {
                    "$ref": "#/definitions/_methodWithBody"
                },
                "responsePath": {
                    "$ref": "#/definitions/responsePath"
                },
                "uriTemplate": {
                    "$ref": "#/definitions/uriTemplate"
                },
                "bodyTemplate": {
                    "$ref": "#/definitions/bodyTemplate"
                },
                "headerInfo": {
                    "$ref": "#/definitions/headerInfo"
                }
            },
            "required": [
                "method",
                "uriTemplate",
                "bodyTemplate"
            ],
            "additionalProperties": false
        }
    ]
}