{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/r/refs/heads/main/json-schema/r-cran-package-schema.json",
  "title": "CRAN Package",
  "description": "Schema for a CRAN R package metadata record as returned by the METACRAN CranDB API",
  "type": "object",
  "properties": {
    "Package": {
      "type": "string",
      "description": "Package name on CRAN",
      "example": "ggplot2"
    },
    "Version": {
      "type": "string",
      "description": "Current package version using semantic versioning",
      "example": "3.4.4"
    },
    "Title": {
      "type": "string",
      "description": "Short one-line title for the package"
    },
    "Description": {
      "type": "string",
      "description": "Full package description paragraph"
    },
    "Author": {
      "type": "string",
      "description": "Package authors, often in Authors@R format"
    },
    "Maintainer": {
      "type": "string",
      "description": "Package maintainer name and email",
      "example": "Hadley Wickham <hadley@posit.co>"
    },
    "License": {
      "type": "string",
      "description": "SPDX license identifier",
      "example": "MIT + file LICENSE"
    },
    "Depends": {
      "type": "string",
      "description": "Required R version and dependent packages"
    },
    "Imports": {
      "type": "string",
      "description": "Imported packages required at runtime"
    },
    "Suggests": {
      "type": "string",
      "description": "Optionally suggested packages"
    },
    "Enhances": {
      "type": "string",
      "description": "Packages enhanced by this package"
    },
    "Date": {
      "type": "string",
      "format": "date",
      "description": "Package release date"
    },
    "URL": {
      "type": "string",
      "description": "URL for the package homepage or development repository"
    },
    "BugReports": {
      "type": "string",
      "format": "uri",
      "description": "URL for submitting bug reports"
    },
    "NeedsCompilation": {
      "type": "string",
      "enum": ["yes", "no"],
      "description": "Whether the package requires compilation"
    },
    "SystemRequirements": {
      "type": "string",
      "description": "External system requirements for the package"
    },
    "Repository": {
      "type": "string",
      "description": "Repository name (typically CRAN)"
    },
    "Date/Publication": {
      "type": "string",
      "format": "date-time",
      "description": "CRAN publication timestamp"
    }
  },
  "required": ["Package", "Version", "Title", "Description", "Maintainer", "License"]
}
