{
    "type": "object",
    "properties": {
        "version": {
            "type": "integer",
            "description": "The version of the Handel schema",
            "minimum": 1,
            "maximum": 1,
            "errorMessage": "The 'version' field must be '1'"
        },
        "name": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9-]+$",
            "maxLength": 30,
            "errorMessage": {
                "type": "The top-level 'name' field must be a string of alphanumeric characters and dashes, no greater than 30 characters",
                "pattern": "The top-level 'name' field may only use alphanumeric characters and dashes",
                "maxLength": "The top-level 'name' field may not be greater than 30 characters"
            }
        },
        "tags": {
            "type": "object",
            "patternProperties": {
                "^[a-zA-Z0-9+\\-=._:\\/@]{1,127}$": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255,
                    "errorMessage": {
                        "type": "Each tag value must be a string",
                        "minLength": "Tag values must have at least 1 character",
                        "maxLength": "Tag values may contain a maximum of 255 characters"
                    }
                }
            },
            "additionalProperties": false,
            "errorMessage": {
                "type": "The 'tags' field must be a key-value map",
                "additionalProperties": "Tag names may contain a maximum of 127 characters, consisting of numbers, letters, and some special characters (+-\\-=._:@/)"
            }
        },
        "extensions": {
            "type": "object",
            "patternProperties": {
                "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{0,62}[a-zA-Z0-9]$": {
                    "type": "string",
                    "errorMessage": {
                        "type": "Each extension value must be a string"
                    }
                }
            },
            "additionalProperties": false,
            "errorMessage": {
                "type": "The 'extensions' field must be a key-value map",
                "additionalProperties": "Extension prefixes must be between 1 and 64 characters long, consisting of letters, numbers, dashes (-) or underscores (_)"
            }
        },
        "environments": {
            "type": "object",
            "patternProperties": {
                "^[a-zA-Z0-9-]{1,10}$": {
                    "type": "object",
                    "patternProperties": {
                        "^[a-zA-Z0-9-]{1,20}$": {
                            "type": "object",
                            "properties": {
                                "type": {
                                    "type": "string"
                                }
                            },
                            "required": ["type"],
                            "errorMessage": {
                                "required": {
                                    "type": "The 'type' field is required in each service definition"
                                }
                            }
                        }
                    },
                    "minProperties": 1,
                    "additionalProperties": false,
                    "errorMessage": {
                        "type": "Each environment definition must be an object",
                        "additionalProperties": "Service name fields may only contain alphanumeric characters and dashes, and be no greater than 20 characters in length",
                        "minProperties": "Environment definitions must contains at least 1 service definition"
                    }
                }
            },
            "minProperties": 1,
            "additionalProperties": false,
            "errorMessage": {
                "type": "The 'environments' field must be an object",
                "additionalProperties": "Environment name fields may only contain alphanumeric characters and dashes, and be no greater than 10 characters in length",
                "minProperties": "The 'environments' field must contain at least 1 environment definition"
            }
        }
    },
    "required": ["version", "name", "environments"],
    "errorMessage": {
        "required": {
            "version": "The top-level 'version' field is required",
            "name": "The top-level 'name' field is required",
            "environments": "The top-level 'environments' field is required"
        }
    }
}