{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://json.schemastore.org/cloudfoundry-application-manifest.json",
  "$comment": "Descriptions are sourced from https://v3-apidocs.cloudfoundry.org/version/3.163.0/#the-manifest-schema, with some details from https://docs.cloudfoundry.org/devguide/deploy-apps/manifest-attributes.html, https://v3-apidocs.cloudfoundry.org/version/3.163.0, and https://docs.cloudfoundry.org/devguide/deploy-apps/healthchecks.html.",
  "$ref": "#/definitions/Manifest",
  "definitions": {
    "Manifest": {
      "type": "object",
      "title": "Cloud Foundry Application Manifest",
      "additionalProperties": false,
      "description": "A manifest describes a Cloud Foundry application and can be used to deploy it to a Foundation. For authoritative reference, see https://docs.cloudfoundry.org/devguide/deploy-apps/manifest-attributes.html.",
      "properties": {
        "version": {
          "description": "The version of the manifest schema. Currently, the only valid version is 1.",
          "type": "integer",
          "default": 1
        },
        "applications": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Application"
          }
        }
      },
      "required": ["applications"]
    },
    "Application": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "description": "Name of the app.",
          "type": "string"
        },
        "buildpacks": {
          "description": "`buildpacks` may contain: \n\na) An empty array, which will automatically select the appropriate default buildpack according to the coding language;\nb) An array of one or more URLs pointing to buildpacks;\nc) An array of one or more installed buildpack names.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "command": {
          "description": "The command used to start the process; this overrides start commands from Procfiles and buildpacks.",
          "type": "string"
        },
        "disk_quota": {
          "description": "The disk limit for all instances of the web process. This attribute requires a unit of measurement: B, K, KB, M, MB, G, GB, T, or TB in upper case or lower case.",
          "type": "string"
        },
        "docker": {
          "$ref": "#/definitions/Docker"
        },
        "env": {
          "$ref": "#/definitions/Env"
        },
        "health-check-type": {
          "$ref": "#/definitions/HealthCheckType"
        },
        "health-check-http-endpoint": {
          "$ref": "#/definitions/HealthCheckHTTPEndpoint"
        },
        "health-check-invocation-timeout": {
          "$ref": "#/definitions/HealthCheckInvocationTimeout"
        },
        "health-check-interval": {
          "$ref": "#/definitions/HealthCheckInterval"
        },
        "readiness-health-check-type": {
          "$ref": "#/definitions/ReadinessHealthCheckType"
        },
        "readiness-health-check-http-endpoint": {
          "$ref": "#/definitions/ReadinessHealthCheckHTTPEndpoint"
        },
        "readiness-health-check-invocation-timeout": {
          "$ref": "#/definitions/ReadinessHealthCheckInvocationTimeout"
        },
        "readiness-health-check-interval": {
          "$ref": "#/definitions/ReadinessHealthCheckInterval"
        },
        "instances": {
          "description": "The number of instances to run. Default is 1.",
          "type": "integer"
        },
        "log-rate-limit-per-second": {
          "type": "string",
          "description": "The log-rate-limit-per-second attribute specifies the log rate limit for all instances of an app. This attribute requires a unit of measurement: B, K, KB, M, MB, G, or GB, in either uppercase or lowercase. Default is 16K."
        },
        "memory": {
          "description": "The memory attribute specifies the memory limit for all instances of an app. This attribute requires a unit of measurement: M, MB, G, or GB, in either uppercase or lowercase. Default is 1G.",
          "type": "string"
        },
        "metadata": {
          "$ref": "#/definitions/Metadata"
        },
        "no-route": {
          "description": "When set to true, any routes specified with the `routes` attribute will be ignored and any existing routes will be removed. Default is false.",
          "type": "boolean"
        },
        "path": {
          "description": "The path attribute tells Cloud Foundry the directory location in which it can find your app. The directory specified as the path, either as an attribute or as a parameter on the command line, becomes the location where the buildpack Detect script runs.",
          "type": "string"
        },
        "processes": {
          "type": "array",
          "description": "List of configurations for individual process types.",
          "items": {
            "$ref": "#/definitions/Process"
          }
        },
        "random-route": {
          "type": "boolean",
          "description": "Creates a random route for the app if true. If `routes` is specified, if the app already has routes, or if `no-route` is specified, this field is ignored regardless of its value. Default is false."
        },
        "routes": {
          "type": "array",
          "description": "List declaring HTTP and TCP routes to be mapped to the app.",
          "items": {
            "$ref": "#/definitions/Route"
          }
        },
        "services": {
          "type": "array",
          "description": "Apps can bind to services such as databases, messaging, and key-value stores. The services block consists of a heading and one or more service instance names.",
          "items": {
            "$ref": "#/definitions/ServiceElement"
          }
        },
        "sidecars": {
          "type": "array",
          "description": "The sidecars attribute specifies additional processes to run in the same container as your app.",
          "items": {
            "$ref": "#/definitions/Sidecar"
          }
        },
        "stack": {
          "description": "The root filesystem to use with the buildpack, for example cflinuxfs4.",
          "type": "string"
        },
        "timeout": {
          "description": "The duration in seconds that health checks can fail before the process is restarted. Default is 60 (seconds).",
          "type": "integer"
        }
      },
      "required": ["name"],
      "title": "Application"
    },
    "Docker": {
      "type": "object",
      "additionalProperties": false,
      "description": "If your app is contained in a Docker image, the docker attribute specifies it and an Docker user name (optional). This attribute is a combination of push options that include --docker-image and --docker-username.",
      "properties": {
        "image": {
          "type": "string"
        },
        "username": {
          "type": "string"
        }
      },
      "required": ["image"],
      "title": "Docker"
    },
    "Env": {
      "type": "object",
      "additionalProperties": true,
      "description": "A key-value mapping of environment variables to be used for the app when running.",
      "title": "Environment Variables"
    },
    "HealthCheckType": {
      "description": "Type of liveliness health check to perform; 'none' is deprecated and an alias to process. Default is 'port'.\n\nLiveness health checks are performed to validate that app instances are running. When liveness health checks fail, the app instance is marked as crashed and is restarted.",
      "enum": ["port", "process", "http"]
    },
    "HealthCheckHTTPEndpoint": {
      "description": "Endpoint called to determine if the app is healthy when readiness-health-check-type='http'. Default is '/'.",
      "type": "string"
    },
    "HealthCheckInvocationTimeout": {
      "description": "The timeout in seconds for individual health check requests for http and port health checks. Default is 1 (second).",
      "type": "integer"
    },
    "HealthCheckInterval": {
      "description": "The amount of time in seconds between starting individual health check requests for HTTP and port health checks. Default is 30 (seconds).",
      "type": "integer"
    },
    "ReadinessHealthCheckType": {
      "description": "Type of readiness health check to perform. Default is 'process'.\n\nReadiness health checks are performed to validate that app instances are ready to serve requests. When readiness health checks fail, the app instance is marked as not ready and removed from the route pool for the app.",
      "enum": ["port", "process", "http"]
    },
    "ReadinessHealthCheckHTTPEndpoint": {
      "description": "Endpoint called to determine if the app is ready to serve requests when readiness-health-check-type='http'. Default is '/'.",
      "type": "string"
    },
    "ReadinessHealthCheckInvocationTimeout": {
      "description": "The timeout in seconds for individual readiness health check requests for HTTP and port health checks. Default is 1 (second).",
      "type": "integer"
    },
    "ReadinessHealthCheckInterval": {
      "description": "The amount of time in seconds between starting individual readiness health check requests for HTTP and port health checks. Default is 30 (seconds).",
      "type": "integer"
    },
    "Metadata": {
      "type": "object",
      "description": "The metadata attribute tags your apps with additional information. You can specify two types of metadata: labels and annotations.",
      "additionalProperties": false,
      "properties": {
        "annotations": {
          "$ref": "#/definitions/KVMetadata",
          "description": "Annotations allow you to add non-identifying metadata to Cloud Foundry resources. You cannot query based on annotations. Also, there are fewer restrictions for key-value pairs of annotations than there are for labels. For example, you can include contact information of persons responsible for the resource, or tool information for debugging purposes.",
          "title": "Annotations"
        },
        "labels": {
          "$ref": "#/definitions/KVMetadata",
          "description": "Labels allow you to identify and select Cloud Foundry resources. For example, if you label all apps running in production or all spaces that contain Internet-facing apps, you can then search for them.",
          "title": "Labels"
        }
      },
      "title": "Metadata"
    },
    "KVMetadata": {
      "type": "object",
      "additionalProperties": true
    },
    "Process": {
      "type": "object",
      "description": "This configuration is for the individual process. Each process is created if it does not already exist. For backwards compatibility, the web process configuration may be placed at the top level of the application configuration, rather than listed under processes. However, if there is a process with type: web listed under processes, this configuration will override any at the top level.",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "description": "The identifier for the processes to be configured."
        },
        "command": {
          "type": "string",
          "description": "The command used to start the process; this overrides start commands from Procfiles and buildpacks."
        },
        "disk_quota": {
          "description": "The disk limit for all instances of the web process. This attribute requires a unit of measurement: B, K, KB, M, MB, G, GB, T, or TB in upper case or lower case.",
          "type": "string"
        },
        "health-check-type": {
          "$ref": "#/definitions/HealthCheckType"
        },
        "health-check-http-endpoint": {
          "$ref": "#/definitions/HealthCheckHTTPEndpoint"
        },
        "health-check-invocation-timeout": {
          "$ref": "#/definitions/HealthCheckInvocationTimeout"
        },
        "health-check-interval": {
          "$ref": "#/definitions/HealthCheckInterval"
        },
        "readiness-health-check-type": {
          "$ref": "#/definitions/ReadinessHealthCheckType"
        },
        "readiness-health-check-http-endpoint": {
          "$ref": "#/definitions/ReadinessHealthCheckHTTPEndpoint"
        },
        "readiness-health-check-invocation-timeout": {
          "$ref": "#/definitions/ReadinessHealthCheckInvocationTimeout"
        },
        "readiness-health-check-interval": {
          "$ref": "#/definitions/ReadinessHealthCheckInterval"
        },
        "instances": {
          "description": "The number of instances to run. Default is 1.",
          "type": "integer"
        },
        "memory": {
          "description": "The memory limit for all instances of the web process. This attribute requires a unit of measurement: B, K, KB, M, MB, G, GB, T, or TB in upper case or lower case.",
          "type": "string"
        },
        "log-rate-limit-per-second": {
          "description": "The log rate limit for all the instances of the process. This attribute requires a unit of measurement: B, K, KB, M, MB, G, GB, T, or TB in upper case or lower case, or -1 or 0.",
          "type": "string"
        },
        "timeout": {
          "description": "Time in seconds at which the health-check will report failure. Default is 60 (seconds).",
          "type": "integer"
        }
      },
      "required": ["type"],
      "title": "Process"
    },
    "Route": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "route": {
          "description": "The route URI. Example: host.domain.com.",
          "type": "string"
        },
        "protocol": {
          "description": "Protocol to use for this route.",
          "enum": ["http2", "http1", "tcp"]
        }
      },
      "required": ["route"],
      "title": "Route"
    },
    "ServiceObject": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "description": "The name of the service instance to be bound to.",
          "type": "string"
        },
        "parameters": {
          "$ref": "#/definitions/ServiceParameters"
        },
        "binding_name": {
          "description": "The name of the service binding to be created",
          "type": "string"
        }
      },
      "required": ["name"],
      "title": "ServiceClass"
    },
    "ServiceParameters": {
      "description": "A map of arbitrary key/value pairs to send to the service broker during binding.",
      "type": "object",
      "additionalProperties": true,
      "title": "Service Parameters"
    },
    "Sidecar": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "description": "The identifier for the sidecars to be configured",
          "type": "string"
        },
        "process_types": {
          "description": "List of processes to associate sidecar with",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "command": {
          "description": "The command used to start the sidecar",
          "type": "string"
        },
        "memory": {
          "description": "Memory that the sidecar will be allocated",
          "type": "string"
        }
      },
      "required": ["command", "name", "process_types"],
      "title": "Sidecar"
    },
    "ServiceElement": {
      "anyOf": [
        {
          "$ref": "#/definitions/ServiceObject"
        },
        {
          "type": "string",
          "title": "Service Name"
        }
      ],
      "title": "Service"
    }
  }
}
