{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/NimbusExperiment",
  "definitions": {
    "NimbusExperiment": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string",
          "description": "Unique identifier for the experiment"
        },
        "id": {
          "type": "string",
          "description": "Unique identifier for the experiment. This is a duplicate of slug, but is a required field\nfor all Remote Settings records."
        },
        "application": {
          "type": "string",
          "description": "A specific product such as Firefox Desktop or Fenix that supports Nimbus experiments"
        },
        "userFacingName": {
          "type": "string",
          "description": "Public name of the experiment displayed on \"about:studies\""
        },
        "userFacingDescription": {
          "type": "string",
          "description": "Short public description of the experiment displayed on on \"about:studies\""
        },
        "isEnrollmentPaused": {
          "type": "boolean",
          "description": "Should we enroll new users into the experiment?"
        },
        "bucketConfig": {
          "type": "object",
          "properties": {
            "randomizationUnit": {
              "type": "string",
              "description": "A unique, stable identifier for the user used as an input to bucket hashing"
            },
            "namespace": {
              "type": "string",
              "description": "Additional inputs to the hashing function"
            },
            "start": {
              "type": "number",
              "description": "Index of start of the range of buckets"
            },
            "count": {
              "type": "number",
              "description": "Number of buckets to check"
            },
            "total": {
              "type": "number",
              "description": "Total number of buckets",
              "default": 10000
            }
          },
          "required": [
            "randomizationUnit",
            "namespace",
            "start",
            "count",
            "total"
          ],
          "additionalProperties": false,
          "description": "Bucketing configuration"
        },
        "probeSets": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "A list of probe set slugs relevant to the experiment analysis"
        },
        "branches": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string",
                "description": "Identifier for the branch"
              },
              "ratio": {
                "type": "number",
                "description": "Relative ratio of population for the branch (e.g. if branch A=1 and branch B=3,\nbranch A would get 25% of the population)",
                "default": 1
              },
              "feature": {
                "type": "object",
                "properties": {
                  "featureId": {
                    "type": "string",
                    "description": "The identifier for the feature flag"
                  },
                  "enabled": {
                    "type": "boolean",
                    "description": "This can be used to turn the whole feature on/off"
                  },
                  "value": {
                    "anyOf": [
                      {
                        "type": "object",
                        "additionalProperties": {}
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Optional extra params for the feature (this should be validated against a schema)"
                  }
                },
                "required": [
                  "featureId",
                  "enabled",
                  "value"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "slug",
              "ratio"
            ],
            "additionalProperties": false
          },
          "description": "Branch configuration for the experiment"
        },
        "targeting": {
          "type": "string",
          "description": "JEXL expression used to filter experiments based on locale, geo, etc."
        },
        "startDate": {
          "type": [
            "string",
            "null"
          ],
          "description": "Actual publish date of the experiment\nNote that this value is expected to be null in Remote Settings.",
          "format": "date-time"
        },
        "endDate": {
          "type": [
            "string",
            "null"
          ],
          "description": "Actual end date of the experiment.\nNote that this value is expected to be null in Remote Settings.",
          "format": "date-time"
        },
        "proposedDuration": {
          "type": "number",
          "description": "Duration of the experiment from the start date in days.\nNote that this value is expected to be null in Remote Settings.\nin Remote Settings."
        },
        "proposedEnrollment": {
          "type": "number",
          "description": "Duration of enrollment from the start date in days"
        },
        "referenceBranch": {
          "type": [
            "string",
            "null"
          ],
          "description": "The slug of the reference branch"
        },
        "filter_expression": {
          "type": "string",
          "description": "This is NOT used by Nimbus, but has special functionality in Remote Settings.\nSee https://remote-settings.readthedocs.io/en/latest/target-filters.html#how"
        }
      },
      "required": [
        "slug",
        "id",
        "application",
        "userFacingName",
        "userFacingDescription",
        "isEnrollmentPaused",
        "bucketConfig",
        "probeSets",
        "branches",
        "startDate",
        "endDate",
        "proposedEnrollment",
        "referenceBranch"
      ],
      "additionalProperties": true,
      "description": "The experiment definition accessible to:\n1. The Nimbus SDK via Remote Settings\n2. Jetstream via the Experimenter API"
    }
  }
}
