{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rossdata-dev/json-schema/rossdata-dev-table-detail-schema.json",
  "title": "TableDetail",
  "description": "Full object detail. Additional key/relationship arrays may accompany the fields below.",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rossdata-dev-openapi.json#/components/schemas/TableDetail",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "object": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "enum": [
        "table",
        "view",
        "procedure",
        "function"
      ]
    },
    "database": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "FIN",
        "MAN"
      ]
    },
    "module": {
      "type": [
        "string",
        "null"
      ]
    },
    "class": {
      "type": [
        "string",
        "null"
      ]
    },
    "source": {
      "type": "string"
    },
    "counts": {
      "type": "object",
      "properties": {
        "columns": {
          "type": "integer"
        },
        "primaryKey": {
          "type": "integer"
        },
        "notNull": {
          "type": "integer"
        },
        "identity": {
          "type": "integer"
        },
        "computed": {
          "type": "integer"
        },
        "foreignKeysOut": {
          "type": "integer"
        },
        "foreignKeysIn": {
          "type": "integer"
        }
      }
    },
    "archiveTwin": {
      "type": [
        "string",
        "null"
      ],
      "description": "Companion archive table, if any"
    },
    "columns": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Column"
      }
    }
  },
  "$defs": {
    "Column": {
      "type": "object",
      "properties": {
        "position": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "nullable": {
          "type": "boolean"
        },
        "primaryKey": {
          "type": "boolean"
        },
        "identity": {
          "type": "boolean"
        },
        "default": {
          "type": [
            "string",
            "null"
          ]
        },
        "computedFormula": {
          "type": [
            "string",
            "null"
          ]
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "validValues": {
          "type": [
            "string",
            "null"
          ],
          "description": "Enumerated valid values, when documented"
        },
        "notes": {
          "type": [
            "string",
            "null"
          ]
        },
        "foreignKey": {
          "type": [
            "object",
            "null"
          ],
          "description": "FK target if this column references another table",
          "properties": {
            "table": {
              "type": "string"
            },
            "column": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}