{
    "$schema": "http://json-schema.org/schema#",
    "type": "object",
    "properties": {
        "type": {
            "type": "string",
            "description": "The service type (should always be 'apigateway')",
            "pattern": "^apigateway$",
            "errorMessage": "Must equal 'apigateway'"
        },
        "proxy": {
            "type": "object",
            "properties": {
                "path_to_code": {
                    "type": "string",
                    "errorMessage": "Must be a string"
                },
                "runtime": {
                    "type": "string",
                    "errorMessage": "Must be a string"
                },
                "handler": {
                    "type": "string",
                    "errorMessage": "Must be a string"
                },
                "memory": {
                    "type": "integer",
                    "errorMessage": "Must be a number"
                },
                "timeout": {
                    "type": "integer",
                    "errorMessage": "Must be a number"
                },
                "warmup": {
                    "type": "object",
                    "properties": {
                        "schedule": {
                            "type": "string",
                            "errorMessage": "Must be a string"
                        },
                        "http_paths": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            },
                            "errorMessage": "Must be a list of strings"
                        }
                    },
                    "additionalProperties": false,
                    "required": [
                        "schedule",
                        "http_paths"
                    ],
                    "errorMessage": {
                        "additionalProperties": "Invalid/unknown property specified",
                        "required": {
                            "schedule": "The 'schedule' field is required",
                            "http_paths": "The 'http_paths' field is required"
                        }
                    }
                },
                "environment_variables": {
                    "type": "object",
                    "description": "Any user-specified environment variables to inject in the application",
                    "patternProperties": {
                        "^.*$": {
                            "anyOf": [
                                {"type": "string"},
                                {"type": "number"},
                                {"type": "boolean"}
                            ]
                        }
                    },
                    "errorMessage": "Must contain 1 or more simple key/value pairs where the values are strings or numbers",
                    "additionalProperties": false
                }
            },
            "additionalProperties": false,
            "required": [
                "path_to_code",
                "runtime",
                "handler"
            ],
            "errorMessage": {
                "additionalProperties": "Invalid/unknown property specified in 'proxy' section",
                "required": {
                    "path_to_code": "The 'path_to_code' field is required",
                    "runtime": "The 'runtime' field is required",
                    "handler": "The 'handler' field is required"
                } 
            }
        },
        "swagger": {
            "type": "string",
            "errorMessage": "Must be a string"
        },
        "description": {
            "type": "string",
            "errorMessage": "Must be a string"
        },
        "binary_media_types": {
            "type": "array",
            "items": {
                "type": "string"
            },
            "errorMessage": "Must be a string"
        },
        "vpc": {
            "type": "boolean",
            "errorMessage": "Must be a boolean true/false value"
        },
        "custom_domains": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "dns_name": {
                        "type": "string",
                        "errorMessage": "Must be a string"
                    },
                    "https_certificate": {
                        "type": "string",
                        "errorMessage": "Must be a string"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "dns_name",
                    "https_certificate"
                ],
                "errorMessage": {
                    "additionalProperties": "Unknown/invalid property specified",
                    "required": {
                        "dns_name": "The 'dns_name' property is required",
                        "https_certificate": "The 'https_certificate' property is required"
                    }
                }
            }
        },
        "tags": {
            "type": "object",
            "description": "An arbitrary list of key/value pairs to be added as tags to the service",
            "patternProperties": {
                "^.*$": {
                    "anyOf": [
                        {"type": "string"},
                        {"type": "number"}
                    ]
                }
            },
            "errorMessage": "Must contain 1 or more simple key/value pairs where the values are strings or numbers",
            "additionalProperties": false
        },
        "dependencies": {
            "type": "array",
            "items": {
                "type": "string",
                "errorMessage": "Each item must be a string"
            },
            "errorMessage": "Must be an array of strings"
        }
    },
    "required": [
        "type"
    ],
    "additionalProperties": false,
    "errorMessage": {
        "additionalProperties": "Invalid/unknown property specified",
        "required": {
            "type": "The 'type' field is required"
        }
    }
}