{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rossdata-dev/json-schema/rossdata-dev-field-lineage-schema.json",
  "title": "FieldLineage",
  "description": "Field-level lineage for a column. scope=field for an exact TABLE.COL; scope=schema-wide for a bare column (aggregated across every table carrying it, in `fields`). Edges appear under populatedFrom (in) and feeds (out).",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rossdata-dev-openapi.json#/components/schemas/FieldLineage",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "scope": {
      "type": "string",
      "enum": [
        "field",
        "schema-wide"
      ]
    },
    "schema": {
      "type": "string"
    },
    "field": {
      "type": "string"
    },
    "column": {
      "type": "string"
    },
    "tableCount": {
      "type": "integer",
      "description": "schema-wide only: tables carrying this column that have lineage"
    },
    "counts": {
      "type": "object",
      "properties": {
        "populatedFrom": {
          "type": "integer"
        },
        "feeds": {
          "type": "integer"
        }
      }
    },
    "populatedFrom": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FieldLineageEdge"
      }
    },
    "feeds": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FieldLineageEdge"
      }
    },
    "fields": {
      "type": "array",
      "description": "schema-wide only: per-table lineage nodes",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    }
  },
  "$defs": {
    "FieldLineageEdge": {
      "type": "object",
      "description": "One field→field flow edge.",
      "properties": {
        "field": {
          "type": "string"
        },
        "table": {
          "type": "string"
        },
        "column": {
          "type": "string"
        },
        "tag": {
          "type": "string",
          "enum": [
            "direct",
            "via-local"
          ],
          "description": "direct = single-statement rhs field ref; via-local = recovered through a #local def-use closure"
        },
        "confidence": {
          "type": "string",
          "enum": [
            "EXTRACTED",
            "INFERRED"
          ]
        },
        "programs": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Programs that carry the flow (up to 6 shown)"
        },
        "programCount": {
          "type": "integer"
        },
        "guarded": {
          "type": "boolean",
          "description": "Present when the write only ever fires inside a conditional"
        },
        "inLoop": {
          "type": "boolean",
          "description": "Present when the write was seen inside a loop body"
        }
      }
    }
  }
}