{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/definitions/RuleSet",
  "$id": "https://ela.st/harp-v1-ruleset.json",
  "definitions": {
    "RuleSet": {
      "properties": {
        "apiVersion": {
          "type": "string",
          "description": "Default to \"harp.elastic.co/v1\"",
          "const": "harp.elastic.co/v1"
        },
        "kind": {
          "type": "string",
          "description": "Default to \"RuleSet\"",
          "const": "RuleSet"
        },
        "meta": {
          "$ref": "#/definitions/harp.bundle.v1.RuleSetMeta",
          "additionalProperties": false,
          "description": "RuleSet metadata"
        },
        "spec": {
          "$ref": "#/definitions/harp.bundle.v1.RuleSetSpec",
          "additionalProperties": false,
          "description": "RuleSet specification"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "Rule Set",
      "description": "RuleSet represents bundle linter ruleset definition."
    },
    "harp.bundle.v1.Rule": {
      "properties": {
        "name": {
          "type": "string",
          "description": "Rule name."
        },
        "description": {
          "type": ["string", "null"],
          "description": "Rule description."
        },
        "path": {
          "type": "string",
          "description": "Rule path matcher filter."
        },
        "constraints": {
          "items": {
            "type": "string"
          },
          "type": ["array", "null"],
          "description": "CEL Constraint collection."
        },
        "rego": {
          "type": ["string", "null"],
          "description": "Rego policy.",
          "contentMediaType": "application/rego"
        },
        "regoFile": {
          "type": ["string", "null"],
          "description": "Rego policy file."
        }
      },
      "required": ["name", "path"],
      "oneOf": [
        {"required": ["constraints"]},
        {"required": ["rego"]},
        {"required": ["regoFile"]}
      ],
      "additionalProperties": false,
      "type": "object",
      "title": "Rule",
      "description": "Rule represents linter rule specification."
    },
    "harp.bundle.v1.RuleSetMeta": {
      "properties": {
        "name": {
          "type": "string",
          "description": "RuleSet name."
        },
        "owner": {
          "type": "string",
          "description": "RuleSet owner."
        },
        "description": {
          "type": "string",
          "description": "Short description for ruleset."
        }
      },
      "required": ["name", "owner", "description"],
      "additionalProperties": false,
      "type": "object",
      "title": "Rule Set Meta",
      "description": "PatchMeta handles patch metadata."
    },
    "harp.bundle.v1.RuleSetSpec": {
      "properties": {
        "rules": {
          "items": {
            "$ref": "#/definitions/harp.bundle.v1.Rule"
          },
          "additionalProperties": false,
          "type": "array",
          "description": "Rule collection."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "Rule Set Spec",
      "description": "RuleSetSpec repesents ruleset specification holder."
    }
  }
}
