{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://runninglake.com/schema/v1alpha1/environment.json",
  "title": "Environment",
  "description": "A Environment as RunningLake's configuration repository declares it, at environments/<name>.yaml. Generated from the Go types the control plane decodes this file into, so it checks the shape the gate reads — field names and types, and which fields may exist. The gate also applies rules no schema can express — required fields inside spec among them — so a file this schema accepts can still be refused by `rl diff`. Take #/properties/spec for the spec alone.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "apiVersion",
    "kind",
    "metadata"
  ],
  "properties": {
    "apiVersion": {
      "type": "string",
      "const": "runninglake.io/v1alpha1",
      "description": "The config schema's version, which is independent of the HTTP API's (rule unsupported-api-version)."
    },
    "kind": {
      "type": "string",
      "const": "Environment",
      "description": "The kind this file declares. A kind that disagrees with the file's path is refused (rule kind-mismatch)."
    },
    "metadata": {
      "required": [
        "name"
      ],
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "pattern": "^[a-z0-9_-]{1,63}$",
          "description": "The resource's name, which is also its path segment. It must be the name this file's path gives it (rule name-mismatch)."
        },
        "labels": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "annotations": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "spec": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": false,
      "properties": {
        "isProduction": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "changePolicy": {
          "description": "How a change reaches this environment: direct (committed when it is submitted), pr (through a pull request) or review (committed after an approval in RunningLake); rule change-policy-invalid refuses any other word. Recorded in the file; nothing reads this field yet — the policy that applies is the environment's own, set when it is created and changed in the console or the API.",
          "type": [
            "string",
            "null"
          ]
        },
        "requireApproval": {
          "description": "Recorded; nothing reads it yet. The approval RunningLake records today is the review change policy's (changePolicy: review), given before the commit.",
          "type": [
            "boolean",
            "null"
          ]
        },
        "dataPlane": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}
