sentry-options-validation 1.0.10

Schema validation library and CLI for sentry-options
Documentation
{
  "Feature": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "description": "The feature name."
      },
      "owner": {
        "$ref": "#/definitions/Owner"
      },
      "segments": {
        "type": "array",
        "items": {
          "$ref": "#/definitions/Segment"
        }
      },
      "enabled": {
        "type": "boolean",
        "default": true,
        "description": "Whether the feature is enabled."
      },
      "created_at": {
        "type": "string",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?)?$",
        "description": "The datetime when this feature was created."
      },
      "description": {
        "type": "string",
        "description": "Human-readable description of the feature."
      }
    },
    "required": ["owner", "segments", "created_at"],
    "additionalProperties": false
  },
  "Owner": {
    "type": "object",
    "properties": {
      "team": {
        "type": "string",
        "minLength": 1,
        "description": "The team that owns this feature."
      },
      "email": {
        "type": ["string", "null"],
        "description": "The email address of the owner. Not required."
      }
    },
    "required": ["team"],
    "additionalProperties": false
  },
  "Segment": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "minLength": 1,
        "description": "A brief description or identifier for the segment."
      },
      "conditions": {
        "type": "array",
        "description": "The list of conditions that must all match for this segment to be active.",
        "items": {
          "oneOf": [
            {"$ref": "#/definitions/InCondition"},
            {"$ref": "#/definitions/NotInCondition"},
            {"$ref": "#/definitions/ContainsCondition"},
            {"$ref": "#/definitions/NotContainsCondition"},
            {"$ref": "#/definitions/EqualsCondition"},
            {"$ref": "#/definitions/NotEqualsCondition"}
          ]
        }
      },
      "rollout": {
        "type": "integer",
        "minimum": 0,
        "maximum": 100,
        "default": 100,
        "description": "Percentage of matching contexts granted the feature (0-100)."
      }
    },
    "required": ["name", "conditions"],
    "additionalProperties": false
  },
  "InCondition": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "description": "Optional name for this condition."
      },
      "property": {
        "type": "string",
        "description": "The evaluation context property to match against."
      },
      "operator": {
        "type": "string",
        "enum": ["in"]
      },
      "value": {
        "anyOf": [
          {"type": "array", "items": {"type": "integer"}},
          {"type": "array", "items": {"type": "number"}},
          {"type": "array", "items": {"type": "string"}}
        ]
      }
    },
    "required": ["property", "operator", "value"],
    "additionalProperties": false
  },
  "NotInCondition": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "description": "Optional name for this condition."
      },
      "property": {
        "type": "string",
        "description": "The evaluation context property to match against."
      },
      "operator": {
        "type": "string",
        "enum": ["not_in"]
      },
      "value": {
        "anyOf": [
          {"type": "array", "items": {"type": "integer"}},
          {"type": "array", "items": {"type": "number"}},
          {"type": "array", "items": {"type": "string"}}
        ]
      }
    },
    "required": ["property", "operator", "value"],
    "additionalProperties": false
  },
  "ContainsCondition": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "description": "Optional name for this condition."
      },
      "property": {
        "type": "string",
        "description": "The evaluation context property to match against."
      },
      "operator": {
        "type": "string",
        "enum": ["contains"]
      },
      "value": {
        "anyOf": [
          {"type": "integer"},
          {"type": "string"},
          {"type": "number"}
        ]
      }
    },
    "required": ["property", "operator", "value"],
    "additionalProperties": false
  },
  "NotContainsCondition": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "description": "Optional name for this condition."
      },
      "property": {
        "type": "string",
        "description": "The evaluation context property to match against."
      },
      "operator": {
        "type": "string",
        "enum": ["not_contains"]
      },
      "value": {
        "anyOf": [
          {"type": "integer"},
          {"type": "string"},
          {"type": "number"}
        ]
      }
    },
    "required": ["property", "operator", "value"],
    "additionalProperties": false
  },
  "EqualsCondition": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "description": "Optional name for this condition."
      },
      "property": {
        "type": "string",
        "description": "The evaluation context property to match against."
      },
      "operator": {
        "type": "string",
        "enum": ["equals"]
      },
      "value": {
        "anyOf": [
          {"type": "integer"},
          {"type": "number"},
          {"type": "string"},
          {"type": "boolean"},
          {"type": "array", "items": {"type": "integer"}},
          {"type": "array", "items": {"type": "number"}},
          {"type": "array", "items": {"type": "string"}}
        ]
      }
    },
    "required": ["property", "operator", "value"],
    "additionalProperties": false
  },
  "NotEqualsCondition": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "description": "Optional name for this condition."
      },
      "property": {
        "type": "string",
        "description": "The evaluation context property to match against."
      },
      "operator": {
        "type": "string",
        "enum": ["not_equals"]
      },
      "value": {
        "anyOf": [
          {"type": "integer"},
          {"type": "number"},
          {"type": "string"},
          {"type": "boolean"},
          {"type": "array", "items": {"type": "integer"}},
          {"type": "array", "items": {"type": "number"}},
          {"type": "array", "items": {"type": "string"}}
        ]
      }
    },
    "required": ["property", "operator", "value"],
    "additionalProperties": false
  }
}