{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/grepr/json-schema/grepr-promotion-policy-schema.json",
  "title": "PromotionPolicy",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/grepr-datasets-api-openapi.yml#/components/schemas/PromotionPolicy",
  "properties": {
    "attributes": {
      "$ref": "#/$defs/PromotionPolicyAttributes"
    },
    "columnRemovalDelay": {
      "description": "How long after a path or key is excluded its index columns are removed from the table, as an ISO-8601 duration. Defaults to 6 hours when absent.",
      "format": "ISO-8601",
      "type": "string"
    },
    "revision": {
      "description": "Which store of the table's policy this is, assigned by the server: 0 when the table has none. Echo it on a PUT to be refused with 409 if the policy changed since it was read; omit it to replace whatever is stored.",
      "format": "int64",
      "type": "integer"
    },
    "tags": {
      "$ref": "#/$defs/PromotionPolicyTags"
    },
    "v": {
      "description": "Promotion policy document version.",
      "format": "int32",
      "type": "integer"
    }
  },
  "required": [
    "attributes",
    "tags",
    "v"
  ],
  "type": "object",
  "$defs": {
    "PromotionPolicyAttributeExclude": {
      "description": "An attribute path whose columns writers stop filling, unless an include covers it, and which are removed from the table at scheduledRemovalAt. No exclude entry is allowed while excludeAllByDefault is on.",
      "properties": {
        "path": {
          "type": "string"
        },
        "prefix": {
          "default": false,
          "type": "boolean"
        },
        "scheduledRemovalAt": {
          "description": "When the columns this entry excludes are removed from the table, assigned by the server. Taking the entry off the exclude list before then keeps them.",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        }
      },
      "required": [
        "path"
      ],
      "type": "object"
    },
    "PromotionPolicyAttributeInclude": {
      "description": "An attribute path indexed whatever an exclude entry or excludeAllByDefault says. It counts against the cap: an exact entry gets its columns when the policy is stored, if the cap has room, and the paths beneath a nested entry are discovered like any other.",
      "properties": {
        "numeric": {
          "default": false,
          "description": "Whether the path gets a numeric index column when the policy is stored, without waiting for a number. Exact entries only: refused when prefix is true.",
          "type": "boolean"
        },
        "path": {
          "type": "string"
        },
        "prefix": {
          "default": false,
          "type": "boolean"
        }
      },
      "required": [
        "path"
      ],
      "type": "object"
    },
    "PromotionPolicyAttributes": {
      "properties": {
        "cap": {
          "default": 0,
          "format": "int32",
          "type": "integer"
        },
        "exclude": {
          "default": [],
          "items": {
            "$ref": "#/$defs/PromotionPolicyAttributeExclude"
          },
          "type": "array"
        },
        "excludeAllByDefault": {
          "default": false,
          "description": "Whether every path no include covers is excluded. Writers stop filling the existing columns no include covers, and they are removed from the table at excludeAllScheduledRemovalAt.",
          "type": "boolean"
        },
        "excludeAllScheduledRemovalAt": {
          "description": "When the columns excludeAllByDefault excludes are removed from the table, assigned by the server. Turning excludeAllByDefault off before then keeps them.",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "include": {
          "default": [],
          "items": {
            "$ref": "#/$defs/PromotionPolicyAttributeInclude"
          },
          "type": "array"
        }
      },
      "required": [
        "cap"
      ],
      "type": "object"
    },
    "PromotionPolicyTags": {
      "properties": {
        "cap": {
          "default": 0,
          "format": "int32",
          "type": "integer"
        },
        "exclude": {
          "default": [],
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "include": {
          "default": [],
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "scheduledRemovalAt": {
          "additionalProperties": {
            "description": "When each excluded key's column is removed from the table, assigned by the server. Taking the key off the exclude list before then keeps the column.",
            "format": "date-time",
            "readOnly": true,
            "type": "string"
          },
          "default": {},
          "description": "When each excluded key's column is removed from the table, assigned by the server. Taking the key off the exclude list before then keeps the column.",
          "readOnly": true,
          "type": "object"
        }
      },
      "required": [
        "cap"
      ],
      "type": "object"
    }
  }
}