{
	"$schema": "http://json-schema.org/draft-07/schema#",
	"type": "object",
	"properties": {
		"version": {
			"type": "number",
			"const": 1,
			"description": "The manifest format. Always 1."
		},
		"name": {
			"description": "Shown on the deploy page.",
			"type": "string",
			"minLength": 1,
			"maxLength": 60
		},
		"description": {
			"description": "Shown on the deploy page.",
			"type": "string",
			"maxLength": 300
		},
		"services": {
			"type": "object",
			"propertyNames": {
				"type": "string",
				"pattern": "^[a-z][a-z0-9-]{0,29}$"
			},
			"additionalProperties": {
				"type": "object",
				"properties": {
					"builder": {
						"description": "How the image is built. Automatic (railpack) by default.",
						"type": "string",
						"enum": [
							"railpack",
							"dockerfile",
							"nixpacks",
							"heroku_buildpacks",
							"paketo_buildpacks",
							"static"
						]
					},
					"dockerfile": {
						"description": "Path to the Dockerfile, relative to the app's folder.",
						"type": "string",
						"maxLength": 200,
						"pattern": "^(?!\\/)(?!.*(?:^|\\/)\\.\\.(?:\\/|$))[A-Za-z0-9._\\-/]+$"
					},
					"installCommand": {
						"description": "Replaces the detected install step (railpack, nixpacks).",
						"type": "string",
						"minLength": 1,
						"maxLength": 1000
					},
					"buildCommand": {
						"description": "Replaces the detected build step (railpack, nixpacks).",
						"type": "string",
						"minLength": 1,
						"maxLength": 1000
					},
					"preDeploy": {
						"description": "Runs in the new image before each deploy goes live, without the volume.",
						"type": "string",
						"minLength": 1,
						"maxLength": 1000
					},
					"start": {
						"description": "The start command, run with sh -c.",
						"type": "string",
						"minLength": 1,
						"maxLength": 1000
					},
					"port": {
						"description": "The port the app listens on. Hangar sets PORT to it.",
						"type": "integer",
						"minimum": 1,
						"maximum": 65535
					},
					"public": {
						"description": "Whether the service gets an HTTPS address. Defaults to true.",
						"type": "boolean"
					},
					"volume": {
						"description": "A persistent volume mounted at path.",
						"type": "object",
						"properties": {
							"path": {
								"type": "string",
								"maxLength": 200,
								"pattern": "^(?!.*(?:^|\\/)\\.\\.(?:\\/|$))\\/[A-Za-z0-9._\\-/]+$"
							}
						},
						"required": [
							"path"
						],
						"additionalProperties": false
					},
					"env": {
						"description": "Variables: a literal, ${{ service.field }} references, generate or prompt.",
						"type": "object",
						"propertyNames": {
							"type": "string",
							"pattern": "^[A-Za-z_][A-Za-z0-9_]{0,127}$"
						},
						"additionalProperties": {
							"anyOf": [
								{
									"type": "string",
									"maxLength": 4096
								},
								{
									"type": "number"
								},
								{
									"type": "boolean"
								},
								{
									"type": "object",
									"properties": {
										"generate": {
											"type": "string",
											"enum": [
												"secret",
												"password",
												"uuid"
											]
										},
										"length": {
											"type": "integer",
											"minimum": 16,
											"maximum": 128
										}
									},
									"required": [
										"generate"
									],
									"additionalProperties": false,
									"description": "A random value made once, when the project is created."
								},
								{
									"type": "object",
									"properties": {
										"prompt": {
											"type": "string",
											"minLength": 1,
											"maxLength": 80
										},
										"description": {
											"type": "string",
											"maxLength": 300
										},
										"default": {
											"anyOf": [
												{
													"type": "string"
												},
												{
													"type": "number"
												},
												{
													"type": "boolean"
												}
											]
										},
										"required": {
											"type": "boolean"
										},
										"secret": {
											"type": "boolean"
										}
									},
									"required": [
										"prompt"
									],
									"additionalProperties": false,
									"description": "A value the person deploying types on the deploy page."
								}
							]
						}
					}
				},
				"additionalProperties": false
			},
			"description": "The applications to create, by name. Up to 5."
		},
		"databases": {
			"description": "Managed databases, by name.",
			"type": "object",
			"propertyNames": {
				"type": "string",
				"pattern": "^[a-z][a-z0-9-]{0,29}$"
			},
			"additionalProperties": {
				"type": "object",
				"properties": {
					"kind": {
						"type": "string",
						"enum": [
							"postgres",
							"mysql",
							"mariadb",
							"mongo",
							"redis"
						]
					}
				},
				"required": [
					"kind"
				],
				"additionalProperties": false
			}
		}
	},
	"required": [
		"version",
		"services"
	],
	"additionalProperties": false,
	"$id": "https://tryhangar.io/schema/hangar.v1.json",
	"title": "hangar.yaml",
	"description": "What a Deploy on Hangar link creates. See https://tryhangar.io/docs/hangar-yaml"
}