{
  "$schema": "http://json-schema.org/draft-07/schema",
  "description": "The top-level web-features data package",
  "type": "object",
  "properties": {
    "browsers": {
      "description": "Browsers and browser release data",
      "type": "object",
      "properties": {
        "chrome": {
          "$ref": "#/definitions/BrowserData"
        },
        "chrome_android": {
          "$ref": "#/definitions/BrowserData"
        },
        "edge": {
          "$ref": "#/definitions/BrowserData"
        },
        "firefox": {
          "$ref": "#/definitions/BrowserData"
        },
        "firefox_android": {
          "$ref": "#/definitions/BrowserData"
        },
        "safari": {
          "$ref": "#/definitions/BrowserData"
        },
        "safari_ios": {
          "$ref": "#/definitions/BrowserData"
        }
      },
      "required": [
        "chrome",
        "chrome_android",
        "edge",
        "firefox",
        "firefox_android",
        "safari",
        "safari_ios"
      ],
      "additionalProperties": false
    },
    "features": {
      "description": "Feature identifiers and data",
      "type": "object",
      "additionalProperties": {
        "oneOf": [
          {
            "$ref": "#/definitions/FeatureData"
          },
          {
            "$ref": "#/definitions/FeatureMovedData"
          },
          {
            "$ref": "#/definitions/FeatureSplitData"
          }
        ],
        "$comment": "Use the `kind` property as a discriminator."
      }
    },
    "groups": {
      "description": "Group identifiers and data",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/GroupData"
      }
    },
    "snapshots": {
      "description": "Snapshot identifiers and data",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/SnapshotData"
      }
    }
  },
  "required": ["browsers", "features", "groups", "snapshots"],
  "additionalProperties": false,
  "definitions": {
    "Discouraged": {
      "type": "object",
      "description": "Whether developers are formally discouraged from using this feature",
      "properties": {
        "according_to": {
          "description": "Links to a formal discouragement notice, such as specification text, intent-to-unship, etc.",
          "$ref": "#/definitions/Strings"
        },
        "alternatives": {
          "description": "IDs for features that substitute some or all of this feature's utility",
          "$ref": "#/definitions/Strings"
        },
        "reason": {
          "description": "A brief, developer-focused description of why the feature is discouraged",
          "type": "string"
        },
        "reason_html": {
          "description": "A brief, developer-focused description of why the feature is discouraged, as an HTML string",
          "type": "string"
        },
        "removal_date": {
          "description": "An expected or actual removal date, as in \"2029-12-31\". Only set if there's an announced plan by all currently-implementing vendors to unship the feature or the feature has already been unshipped from all browsers.",
          "type": "string"
        }
      },
      "required": ["according_to", "reason", "reason_html"],
      "additionalProperties": false
    },
    "BrowserData": {
      "description": "Browser information",
      "type": "object",
      "properties": {
        "name": {
          "description": "The name of the browser, as in \"Edge\" or \"Safari on iOS\"",
          "type": "string"
        },
        "releases": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Release"
          }
        }
      },
      "required": ["name", "releases"],
      "additionalProperties": false
    },
    "FeatureData": {
      "description": "A feature data entry",
      "type": "object",
      "properties": {
        "kind": {
          "const": "feature"
        },
        "name": {
          "description": "Short name",
          "type": "string"
        },
        "description": {
          "description": "Short description of the feature, as a plain text string",
          "type": "string"
        },
        "description_html": {
          "description": "Short description of the feature, as an HTML string",
          "type": "string"
        },
        "spec": {
          "description": "Specification URLs",
          "$ref": "#/definitions/Strings"
        },
        "group": {
          "description": "Group identifiers",
          "$ref": "#/definitions/Strings"
        },
        "snapshot": {
          "description": "Snapshot identifiers",
          "$ref": "#/definitions/Strings"
        },
        "caniuse": {
          "description": "caniuse.com identifiers",
          "$ref": "#/definitions/Strings"
        },
        "compat_features": {
          "description": "Sources of support data for this feature",
          "$ref": "#/definitions/Strings"
        },
        "status": {
          "description": "Whether a feature is considered a \"Baseline\" web platform feature and when it achieved that status",
          "$ref": "#/definitions/StatusHeadline"
        },
        "discouraged": {
          "description": "Whether developers are formally discouraged from using this feature",
          "$ref": "#/definitions/Discouraged"
        }
      },
      "required": [
        "kind",
        "name",
        "description",
        "description_html",
        "spec",
        "status"
      ],
      "additionalProperties": false
    },
    "FeatureMovedData": {
      "description": "A feature has permanently moved to exactly one other ID",
      "type": "object",
      "properties": {
        "kind": {
          "const": "moved"
        },
        "redirect_target": {
          "description": "The new ID for this feature",
          "type": "string"
        }
      },
      "required": ["kind", "redirect_target"],
      "additionalProperties": false
    },
    "FeatureSplitData": {
      "description": "A feature has split into two or more other features",
      "type": "object",
      "properties": {
        "kind": {
          "const": "split"
        },
        "redirect_targets": {
          "description": "The new IDs for this feature",
          "$ref": "#/definitions/Strings"
        }
      },
      "required": ["kind", "redirect_targets"],
      "additionalProperties": false
    },
    "GroupData": {
      "type": "object",
      "properties": {
        "name": {
          "description": "Short name",
          "type": "string"
        },
        "parent": {
          "description": "Identifier of parent group",
          "type": "string"
        }
      },
      "required": ["name"],
      "additionalProperties": false
    },
    "Release": {
      "description": "Browser release information",
      "type": "object",
      "properties": {
        "version": {
          "description": "The version string, as in \"10\" or \"17.1\"",
          "type": "string"
        },
        "date": {
          "description": " The release date, as in \"2023-12-11\"",
          "type": "string"
        }
      },
      "required": ["version", "date"],
      "additionalProperties": false
    },
    "SnapshotData": {
      "type": "object",
      "properties": {
        "name": {
          "description": "Short name",
          "type": "string"
        },
        "spec": {
          "description": "Specification",
          "type": "string"
        }
      },
      "required": ["name", "spec"],
      "additionalProperties": false
    },
    "Status": {
      "type": "object",
      "properties": {
        "baseline": {
          "description": "Whether the feature is Baseline (low substatus), Baseline (high substatus), or not (false)",
          "enum": ["high", "low", false]
        },
        "baseline_high_date": {
          "description": "Date the feature achieved Baseline high status",
          "type": "string"
        },
        "baseline_low_date": {
          "description": "Date the feature achieved Baseline low status",
          "type": "string"
        },
        "support": {
          "description": "Browser versions that most-recently introduced the feature",
          "type": "object",
          "properties": {
            "chrome": {
              "type": "string"
            },
            "chrome_android": {
              "type": "string"
            },
            "edge": {
              "type": "string"
            },
            "firefox": {
              "type": "string"
            },
            "firefox_android": {
              "type": "string"
            },
            "safari": {
              "type": "string"
            },
            "safari_ios": {
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "required": ["baseline", "support"]
    },
    "StatusHeadline": {
      "type": "object",
      "allOf": [{ "$ref": "#/definitions/Status" }],
      "properties": {
        "baseline": {},
        "baseline_high_date": {},
        "baseline_low_date": {},
        "support": {},
        "by_compat_key": {
          "description": "Statuses for each key in the feature's compat_features list, if applicable.",
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/Status"
          }
        }
      },
      "required": ["baseline", "support"],
      "additionalProperties": false
    },
    "Strings": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1
    }
  }
}
