{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://github.com/elastic/elasticsearch/tree/main/docs/changelog",
  "$ref": "#/definitions/Changelog",
  "definitions": {
    "Changelog": {
      "type": "object",
      "properties": {
        "pr": {
          "type": "integer"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "integer"
          }
        },
        "area": {
          "type": "string",
          "enum": [
            "Aggregations",
            "Allocation",
            "Analysis",
            "Application",
            "Audit",
            "Authentication",
            "Authorization",
            "Autoscaling",
            "CAT APIs",
            "CCR",
            "CCS",
            "CRUD",
            "Client",
            "Cluster Coordination",
            "Codec",
            "Data streams",
            "DLM",
            "Discovery-Plugins",
            "Distributed",
            "Downsampling",
            "EQL",
            "ES|QL",
            "Engine",
            "Experiences",
            "Extract&Transform",
            "FIPS",
            "Features",
            "Geo",
            "Graph",
            "Health",
            "Highlighting",
            "ILM+SLM",
            "IdentityProvider",
            "Indices APIs",
            "Inference",
            "Infra/CLI",
            "Infra/Circuit Breakers",
            "Infra/Core",
            "Infra/Logging",
            "Infra/Node Lifecycle",
            "Infra/Plugins",
            "Infra/REST API",
            "Infra/Resiliency",
            "Infra/Scripting",
            "Infra/Settings",
            "Infra/Transport API",
            "Infra/Metrics",
            "Ingest",
            "Ingest Node",
            "Java High Level REST Client",
            "Java Low Level REST Client",
            "License",
            "Logs",
            "Machine Learning",
            "Mapping",
            "Monitoring",
            "Network",
            "Packaging",
            "Percolator",
            "Performance",
            "Query Languages",
            "Ranking",
            "Recovery",
            "Reindex",
            "Relevance",
            "Rollup",
            "SQL",
            "Search",
            "Searchable Snapshots",
            "Security",
            "Snapshot/Restore",
            "Stats",
            "Store",
            "Suggesters",
            "Task Management",
            "TLS",
            "Transform",
            "TSDB",
            "Vector Search",
            "Watcher"
          ]
        },
        "type": {
          "type": "string",
          "enum": [
            "breaking",
            "breaking-java",
            "bug",
            "deprecation",
            "enhancement",
            "feature",
            "known-issue",
            "new-aggregation",
            "regression",
            "security",
            "upgrade"
          ]
        },
        "summary": {
          "type": "string",
          "minLength": 1
        },
        "highlight": {
          "$ref": "#/definitions/Highlight"
        },
        "breaking": {
          "$ref": "#/definitions/CompatibilityChange"
        },
        "deprecation": {
          "$ref": "#/definitions/CompatibilityChange"
        }
      },
      "required": [
        "type",
        "summary"
      ],
      "anyOf": [
        {
          "$comment": "PR number and area fields not required for known-issue type",
          "if": {
            "not": {
              "properties": {
                "type": {
                  "const": "known-issue"
                }
              }
            }
          },
          "then": {
            "required": [
              "pr",
              "area"
            ]
          }
        },
        {
          "$comment": "PR number and area fields not required for security type",
          "if": {
            "not": {
              "properties": {
                "type": {
                  "const": "security"
                }
              }
            }
          },
          "then": {
            "required": [
              "pr",
              "area"
            ]
          }
        }
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "type": {
                "const": "breaking"
              }
            }
          },
          "then": {
            "required": [
              "breaking"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "breaking-java"
              }
            }
          },
          "then": {
            "required": [
              "breaking"
            ]
          }
        }
      ],
      "if": {
        "properties": {
          "type": {
            "const": "deprecation"
          }
        }
      },
      "then": {
        "required": [
          "deprecation"
        ]
      },
      "additionalProperties": false
    },
    "Highlight": {
      "properties": {
        "notable": {
          "type": "boolean"
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "body": {
          "type": "string",
          "pattern": "(?s)^((?!```).)*$",
          "minLength": 1
        }
      },
      "required": [
        "title",
        "body"
      ],
      "message": {
        "pattern": "Changelog uses a triple-backtick (```) in a details section, but it must be formatted as a Asciidoc code block. For example:\n\n    [source,yaml]\n    ----\n    {\n      \"metrics.time\" : 10,\n      \"metrics.time.min\" : 1,\n      \"metrics.time.max\" : 500\n    }\n    ----\n"
      },
      "additionalProperties": false
    },
    "CompatibilityChange": {
      "properties": {
        "area": {
          "$ref": "#/definitions/compatibilityChangeArea"
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "details": {
          "type": "string",
          "pattern": "(?s)^((?!```).)*$",
          "minLength": 1
        },
        "impact": {
          "type": "string",
          "pattern": "(?s)^((?!```).)*$",
          "minLength": 1
        },
        "notable": {
          "type": "boolean"
        },
        "ess_setting_change": {
          "type": "boolean"
        }
      },
      "required": [
        "area",
        "title",
        "details",
        "impact"
      ],
      "message": {
        "pattern": "Changelog uses a triple-backtick (```) in a details section, but it must be formatted as a Asciidoc code block. For example:\n\n    [source,yaml]\n    ----\n    {\n      \"metrics.time\" : 10,\n      \"metrics.time.min\" : 1,\n      \"metrics.time.max\" : 500\n    }\n    ----\n"
      },
      "additionalProperties": false
    },
    "compatibilityChangeArea": {
      "type": "string",
      "enum": [
        "Aggregations",
        "Analysis",
        "Authorization",
        "Cluster and node setting",
        "Command line tool",
        "CRUD",
        "ES|QL",
        "Index setting",
        "Ingest",
        "JVM option",
        "Java API",
        "Logging",
        "Logs",
        "Mapping",
        "Packaging",
        "Painless",
        "REST API",
        "Rollup",
        "Search",
        "System requirement",
        "Transform"
      ]
    },
    "additionalProperties": false
  }
}
