{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/repowise-dev/json-schema/repowise-dev-external-system-relationship-graph-response-schema.json",
  "title": "ExternalSystemRelationshipGraphResponse",
  "description": "Bounded aggregate-first relationship graph for one declared package.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/repowise-dev-external-systems-api-openapi.yml#/components/schemas/ExternalSystemRelationshipGraphResponse",
  "properties": {
    "package_key": {
      "type": "string",
      "title": "Package Key"
    },
    "package_name": {
      "type": "string",
      "title": "Package Name"
    },
    "package_node_id": {
      "type": "string",
      "title": "Package Node Id"
    },
    "match_basis": {
      "type": "string",
      "enum": [
        "exact",
        "subpath",
        "mapped",
        "mixed",
        "unresolved"
      ],
      "title": "Match Basis"
    },
    "matched_external_nodes": {
      "items": {
        "$ref": "#/$defs/ExternalSystemGraphTarget"
      },
      "type": "array",
      "title": "Matched External Nodes"
    },
    "matched_external_nodes_total": {
      "type": "integer",
      "title": "Matched External Nodes Total"
    },
    "matched_external_nodes_truncated": {
      "type": "boolean",
      "title": "Matched External Nodes Truncated"
    },
    "evidence_target_limit": {
      "type": "integer",
      "title": "Evidence Target Limit"
    },
    "evidence_truncated": {
      "type": "boolean",
      "title": "Evidence Truncated"
    },
    "nodes": {
      "items": {
        "$ref": "#/$defs/ExternalSystemRelationshipNode"
      },
      "type": "array",
      "title": "Nodes"
    },
    "edges": {
      "items": {
        "$ref": "#/$defs/ExternalSystemRelationshipEdge"
      },
      "type": "array",
      "title": "Edges"
    },
    "aggregate_total": {
      "type": "integer",
      "title": "Aggregate Total"
    },
    "aggregate_returned": {
      "type": "integer",
      "title": "Aggregate Returned"
    },
    "edge_total": {
      "type": "integer",
      "title": "Edge Total"
    },
    "edge_returned": {
      "type": "integer",
      "title": "Edge Returned"
    },
    "importing_file_total": {
      "type": "integer",
      "title": "Importing File Total"
    },
    "import_edge_total": {
      "type": "integer",
      "title": "Import Edge Total"
    },
    "node_limit": {
      "type": "integer",
      "title": "Node Limit"
    },
    "edge_limit": {
      "type": "integer",
      "title": "Edge Limit"
    },
    "truncated": {
      "type": "boolean",
      "title": "Truncated"
    },
    "scope": {
      "type": "string",
      "enum": [
        "primary",
        "all"
      ],
      "title": "Scope"
    }
  },
  "type": "object",
  "required": [
    "package_key",
    "package_name",
    "package_node_id",
    "match_basis",
    "matched_external_nodes",
    "matched_external_nodes_total",
    "matched_external_nodes_truncated",
    "evidence_target_limit",
    "evidence_truncated",
    "nodes",
    "edges",
    "aggregate_total",
    "aggregate_returned",
    "edge_total",
    "edge_returned",
    "importing_file_total",
    "import_edge_total",
    "node_limit",
    "edge_limit",
    "truncated",
    "scope"
  ],
  "$defs": {
    "ExternalSystemGraphTarget": {
      "properties": {
        "node_id": {
          "type": "string",
          "title": "Node Id"
        },
        "match_basis": {
          "type": "string",
          "enum": [
            "exact",
            "subpath",
            "mapped"
          ],
          "title": "Match Basis"
        }
      },
      "type": "object",
      "required": [
        "node_id",
        "match_basis"
      ],
      "title": "ExternalSystemGraphTarget",
      "description": "One persisted external graph node linked to the selected package."
    },
    "ExternalSystemRelationshipEdge": {
      "properties": {
        "source": {
          "type": "string",
          "title": "Source"
        },
        "target": {
          "type": "string",
          "title": "Target"
        },
        "import_edge_count": {
          "type": "integer",
          "title": "Import Edge Count"
        }
      },
      "type": "object",
      "required": [
        "source",
        "target",
        "import_edge_count"
      ],
      "title": "ExternalSystemRelationshipEdge"
    },
    "ExternalSystemRelationshipNode": {
      "properties": {
        "aggregate_key": {
          "type": "string",
          "title": "Aggregate Key"
        },
        "label": {
          "type": "string",
          "title": "Label"
        },
        "community_id": {
          "type": "integer",
          "title": "Community Id"
        },
        "importing_file_count": {
          "type": "integer",
          "title": "Importing File Count"
        },
        "import_edge_count": {
          "type": "integer",
          "title": "Import Edge Count"
        },
        "top_file": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Top File"
        }
      },
      "type": "object",
      "required": [
        "aggregate_key",
        "label",
        "community_id",
        "importing_file_count",
        "import_edge_count"
      ],
      "title": "ExternalSystemRelationshipNode",
      "description": "A first-party graph community that imports the selected package."
    }
  }
}