{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/repowise-dev/json-schema/repowise-dev-package-usage-response-schema.json",
  "title": "PackageUsageResponse",
  "description": "Where one package is imported: sites, components, owner teams, reachability.",
  "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/PackageUsageResponse",
  "properties": {
    "package": {
      "type": "string",
      "title": "Package"
    },
    "ecosystem": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ecosystem"
    },
    "declared": {
      "items": {
        "$ref": "#/$defs/PackageUsageDeclaration"
      },
      "type": "array",
      "title": "Declared"
    },
    "summary": {
      "$ref": "#/$defs/PackageUsageSummary"
    },
    "sites": {
      "items": {
        "$ref": "#/$defs/PackageUsageSite"
      },
      "type": "array",
      "title": "Sites"
    },
    "components": {
      "items": {
        "$ref": "#/$defs/PackageUsageComponent"
      },
      "type": "array",
      "title": "Components"
    },
    "method": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object",
      "title": "Method"
    },
    "note": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Note"
    }
  },
  "type": "object",
  "required": [
    "package",
    "declared",
    "summary",
    "sites",
    "components",
    "method"
  ],
  "$defs": {
    "PackageUsageComponent": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "files": {
          "type": "integer",
          "title": "Files"
        },
        "owners": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Owners"
        }
      },
      "type": "object",
      "required": [
        "name",
        "files",
        "owners"
      ],
      "title": "PackageUsageComponent"
    },
    "PackageUsageDeclaration": {
      "properties": {
        "package_key": {
          "type": "string",
          "title": "Package Key"
        },
        "version": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Version"
        },
        "declared_in": {
          "type": "string",
          "title": "Declared In"
        },
        "dev": {
          "type": "boolean",
          "title": "Dev",
          "default": false
        }
      },
      "type": "object",
      "required": [
        "package_key",
        "declared_in"
      ],
      "title": "PackageUsageDeclaration"
    },
    "PackageUsageModule": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "mapping": {
          "type": "string",
          "enum": [
            "declared",
            "inferred"
          ],
          "title": "Mapping"
        }
      },
      "type": "object",
      "required": [
        "name",
        "mapping"
      ],
      "title": "PackageUsageModule",
      "description": "One module the file imports and how it was matched to the package."
    },
    "PackageUsageReachability": {
      "properties": {
        "state": {
          "type": "string",
          "title": "State"
        },
        "basis": {
          "type": "string",
          "title": "Basis"
        }
      },
      "type": "object",
      "required": [
        "state",
        "basis"
      ],
      "title": "PackageUsageReachability"
    },
    "PackageUsageSite": {
      "properties": {
        "path": {
          "type": "string",
          "title": "Path"
        },
        "modules": {
          "items": {
            "$ref": "#/$defs/PackageUsageModule"
          },
          "type": "array",
          "title": "Modules"
        },
        "symbols": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Symbols"
        },
        "mapping": {
          "type": "string",
          "enum": [
            "declared",
            "inferred"
          ],
          "title": "Mapping"
        },
        "line": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Line"
        },
        "statement": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Statement"
        },
        "component": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Component"
        },
        "owners": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Owners"
        },
        "owner_counts": {
          "anyOf": [
            {
              "additionalProperties": {
                "type": "integer"
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Owner Counts"
        },
        "reachability": {
          "$ref": "#/$defs/PackageUsageReachability"
        }
      },
      "type": "object",
      "required": [
        "path",
        "modules",
        "symbols",
        "mapping",
        "owners",
        "reachability"
      ],
      "title": "PackageUsageSite",
      "description": "One file importing the package."
    },
    "PackageUsageSummary": {
      "properties": {
        "files": {
          "type": "integer",
          "title": "Files"
        },
        "components": {
          "type": "integer",
          "title": "Components"
        },
        "reachability": {
          "additionalProperties": {
            "type": "integer"
          },
          "type": "object",
          "title": "Reachability"
        },
        "inferred_files": {
          "type": "integer",
          "title": "Inferred Files"
        }
      },
      "type": "object",
      "required": [
        "files",
        "components",
        "reachability",
        "inferred_files"
      ],
      "title": "PackageUsageSummary"
    }
  }
}