{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/Features",
  "definitions": {
    "Features": {
      "patternProperties": {
        "[a-zA-Z0-9_]+": {
          "additionalProperties": false,
          "type": "object",
          "properties": {
            "description": {
              "type": "string"
            },
            "hasExposure": {
              "type": "boolean",
              "description": "If the feature sends an exposure event."
            },
            "exposureDescription": {
              "type": "string",
              "description": "A description of the implementation details of the exposure event, if one is sent."
            },
            "isEarlyStartup": {
              "type": "boolean",
              "description": "If the feature values should be cached in prefs for fast early startup."
            },
            "variables": {
              "additionalProperties": false,
              "type": "object",
              "patternProperties": {
                "[a-zA-Z0-9_]+": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": ["json", "boolean", "int", "string"]
                    },
                    "fallbackPref": {
                      "type": "string"
                    },
                    "enum": {
                      "description": "Validate feature value using a list of possible options (for string only values)."
                    },
                    "description": {
                      "type": "string",
                      "description": "Explain how this value is being used"
                    },
                    "setPref": {
                      "type": "object",
                      "properties": {
                        "branch": {
                          "type": "string",
                          "enum": ["user", "default"],
                        },
                        "pref": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "required": ["type", "description"],
                  "additionalProperties": false
                }
              }
            }
          },
          "required": ["description", "hasExposure"],
          "if": {
            "properties": {
              "hasExposure": {
                "const": true
              }
            }
          },
          "then": {
            "required": ["exposureDescription"]
          }
        }
      }
    }
  }
}
