{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/antfly/json-schema/antfly-relational-row-query-request-schema.json",
  "title": "RelationalRowQueryRequest",
  "description": "Bounded relational scan in primary-key order, or composite index order\nwhen index is supplied. Index queries require schema_version and every\nowning shard must have the selected generation ready. Partial indexes\nrequire their WHERE predicates to be implied by the query conditions.\nThe bounded proof combines per-column equality, tighter ranges,\nexclusions, and NULL-aware predicates using exact typed values and\nmatching collations. Unsupported implications fail closed. Explicit\nscan bounds alone are not an implication proof. Equal tuples are\nordered by primary key. Each shard read pins its own immutable schema\nand row snapshot; this is not a table-wide consistent snapshot.\nResume with the last returned _id as from for primary scans, or its\ncursor as after for index scans. A resumed request opens a fresh snapshot,\nnot a retained cursor; concurrent mutations may move rows across the\ncontinuation boundary. Keep index, bounds and conditions unchanged when paging.\nAn empty projection returns row identities and versions only.\n",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/antfly-data-operations-api-openapi.yml#/components/schemas/RelationalRowQueryRequest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "fields"
  ],
  "properties": {
    "index": {
      "type": "string",
      "minLength": 1,
      "description": "Ready composite secondary index. Requires schema_version; cannot be combined with from/to."
    },
    "after": {
      "type": "string",
      "maxLength": 2097248,
      "description": "Opaque exclusive index-order cursor from the last returned row. Binds the immutable schema version, logical index name, and comparison semantics, independent of owner-local physical generations. Each owner must still prove its current local index is ready."
    },
    "lower": {
      "$ref": "#/$defs/RelationalRowIndexBound"
    },
    "upper": {
      "$ref": "#/$defs/RelationalRowIndexBound"
    },
    "fields": {
      "type": "array",
      "maxItems": 256,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "conditions": {
      "type": "array",
      "maxItems": 256,
      "items": {
        "$ref": "#/$defs/RelationalRowCondition"
      }
    },
    "from": {
      "type": "string",
      "description": "Exclusive lower primary-key bound, including pagination continuation."
    },
    "to": {
      "type": "string",
      "description": "Exclusive upper primary-key bound."
    },
    "limit": {
      "type": "integer",
      "format": "uint32",
      "minimum": 1,
      "maximum": 4096,
      "default": 128
    },
    "schema_version": {
      "type": "integer",
      "format": "uint32",
      "x-go-type-skip-optional-pointer": false,
      "description": "Reject the read if an owning shard has a different active schema epoch. Zero is a valid epoch and is distinct from omission."
    }
  },
  "$defs": {
    "RelationalComparisonOp": {
      "type": "string",
      "enum": [
        "is_null",
        "is_not_null",
        "eq",
        "ne",
        "gt",
        "gte",
        "lt",
        "lte",
        "is_distinct",
        "is_not_distinct"
      ]
    },
    "RelationalRowCondition": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "column",
        "op"
      ],
      "properties": {
        "column": {
          "type": "string",
          "minLength": 1
        },
        "op": {
          "$ref": "#/$defs/RelationalComparisonOp"
        },
        "value": {
          "description": "Typed scalar operand. Omission means NULL. Integer columns also accept exact decimal strings."
        },
        "collation": {
          "type": "string"
        }
      }
    },
    "RelationalRowIndexBound": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "values"
      ],
      "description": "Typed left-prefix bound in declared index order, including descending components. Inclusive bounds include the entire matching prefix. Integer components accept exact decimal strings; null is an indexed null.\n",
      "properties": {
        "values": {
          "type": "array",
          "minItems": 1,
          "maxItems": 256,
          "items": {}
        },
        "inclusive": {
          "type": "boolean",
          "default": true
        }
      }
    }
  }
}