{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://gmr.github.io/pglifecycle/schemata/operator_family.json",
  "title": "Operator Family",
  "description": "An operator family (CREATE OPERATOR FAMILY). The operators and functions here are the members that are added to the family with ALTER OPERATOR FAMILY ... ADD. The members of an operator class are in the class.\n",
  "type": "object",
  "properties": {
    "name": {
      "title": "Name",
      "description": "The name of the operator family.",
      "type": "string"
    },
    "schema": {
      "title": "Schema",
      "description": "The schema the operator family is created in.",
      "type": "string"
    },
    "owner": {
      "title": "Owner",
      "description": "The role that owns the operator family.",
      "type": "string"
    },
    "method": {
      "title": "Index Method",
      "description": "The index access method the family is for (USING).",
      "type": "string"
    },
    "operators": {
      "title": "Operators",
      "description": "The operators that belong to the family.",
      "type": "array",
      "items": {
        "title": "Operator Class Operator",
        "description": "An operator of an operator class or family: OPERATOR strategy name (left, right) [FOR ORDER BY sort_family].\n",
        "type": "object",
        "properties": {
          "strategy": {
            "title": "Strategy Number",
            "description": "The index method's strategy number for the operator.",
            "type": "integer",
            "minimum": 1
          },
          "name": {
            "title": "Operator",
            "description": "The operator, schema-qualified when it is not in pg_catalog.",
            "type": "string"
          },
          "arguments": {
            "title": "Operand Types",
            "description": "The left and right operand types.",
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 2,
            "maxItems": 2
          },
          "order_by": {
            "title": "Sort Family",
            "description": "The btree operator family that sorts the result of an ordering operator (FOR ORDER BY). Without it, the operator is a search operator.\n",
            "type": "string"
          }
        },
        "additionalProperties": false,
        "required": [
          "strategy",
          "name"
        ]
      }
    },
    "functions": {
      "title": "Support Functions",
      "description": "The support functions that belong to the family.",
      "type": "array",
      "items": {
        "title": "Operator Class Function",
        "description": "A support function of an operator class or family: FUNCTION number (left, right) function(arguments).\n",
        "type": "object",
        "properties": {
          "support": {
            "title": "Support Number",
            "description": "The index method's support function number.",
            "type": "integer",
            "minimum": 1
          },
          "types": {
            "title": "Operand Types",
            "description": "The left and right operand types the function is for.",
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 2,
            "maxItems": 2
          },
          "function": {
            "title": "Function",
            "description": "The function and its argument types.",
            "type": "string"
          }
        },
        "additionalProperties": false,
        "required": [
          "support",
          "function"
        ]
      }
    },
    "comment": {
      "title": "Comment",
      "description": "An optional comment about the operator family.",
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "schema",
    "method"
  ]
}