{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://nuget.org/schemas/nuget/package.json",
  "title": "NuGet Package",
  "description": "A NuGet package with its metadata, versions, dependencies, deprecation status, and vulnerability information as represented across the NuGet V3 API.",
  "type": "object",
  "required": ["id", "version"],
  "properties": {
    "id": {
      "type": "string",
      "description": "The unique identifier of the NuGet package.",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[a-zA-Z0-9._-]+$"
    },
    "version": {
      "type": "string",
      "description": "The full SemVer 2.0.0 version string of the package. May contain build metadata."
    },
    "title": {
      "type": "string",
      "description": "The display title of the package."
    },
    "description": {
      "type": "string",
      "description": "A description of the package and its functionality."
    },
    "summary": {
      "type": "string",
      "description": "A short summary of the package."
    },
    "authors": {
      "oneOf": [
        { "type": "string" },
        { "type": "array", "items": { "type": "string" } }
      ],
      "description": "The author or authors of the package."
    },
    "owners": {
      "oneOf": [
        { "type": "string" },
        { "type": "array", "items": { "type": "string" } }
      ],
      "description": "The owner or owners of the package on the package source."
    },
    "tags": {
      "oneOf": [
        { "type": "string" },
        { "type": "array", "items": { "type": "string" } }
      ],
      "description": "Tags associated with the package for categorization and discovery."
    },
    "language": {
      "type": "string",
      "description": "The language of the package content."
    },
    "iconUrl": {
      "type": "string",
      "format": "uri",
      "description": "The URL to the package icon image."
    },
    "licenseUrl": {
      "type": "string",
      "format": "uri",
      "description": "The URL to the package license."
    },
    "licenseExpression": {
      "type": "string",
      "description": "A NuGet license expression compliant with NuGet license expression syntax."
    },
    "projectUrl": {
      "type": "string",
      "format": "uri",
      "description": "The URL to the project home page."
    },
    "readmeUrl": {
      "type": "string",
      "format": "uri",
      "description": "A URL for the rendered HTML view of the package README."
    },
    "registration": {
      "type": "string",
      "format": "uri",
      "description": "The absolute URL to the registration index for this package."
    },
    "packageContent": {
      "type": "string",
      "format": "uri",
      "description": "The URL to the .nupkg file for the latest version."
    },
    "listed": {
      "type": "boolean",
      "description": "Whether the package is listed and visible in search results. Assumed true if absent."
    },
    "published": {
      "type": "string",
      "format": "date-time",
      "description": "An ISO 8601 timestamp of when the package was published. Set to year 1900 on nuget.org when unlisted."
    },
    "created": {
      "type": "string",
      "format": "date-time",
      "description": "A timestamp of when the package was first created on the source."
    },
    "verified": {
      "type": "boolean",
      "description": "Whether the package is verified via ID prefix reservation on nuget.org."
    },
    "totalDownloads": {
      "type": "integer",
      "minimum": 0,
      "description": "The total number of downloads across all versions."
    },
    "requireLicenseAcceptance": {
      "type": "boolean",
      "description": "Whether the package requires the user to accept a license before installation."
    },
    "minClientVersion": {
      "type": "string",
      "description": "The minimum NuGet client version required to use this package."
    },
    "isPrerelease": {
      "type": "boolean",
      "description": "Whether the package version is a prerelease version."
    },
    "packageHash": {
      "type": "string",
      "description": "The hash of the package encoded in standard base 64."
    },
    "packageHashAlgorithm": {
      "type": "string",
      "description": "The hashing algorithm used to produce the packageHash. Typically SHA512.",
      "enum": ["SHA512"]
    },
    "packageSize": {
      "type": "integer",
      "minimum": 0,
      "description": "The size of the .nupkg file in bytes."
    },
    "versions": {
      "type": "array",
      "description": "All available versions of the package.",
      "items": {
        "$ref": "#/$defs/PackageVersion"
      }
    },
    "dependencyGroups": {
      "type": "array",
      "description": "The dependencies of the package grouped by target framework.",
      "items": {
        "$ref": "#/$defs/DependencyGroup"
      }
    },
    "packageTypes": {
      "type": "array",
      "description": "The package types defined by the package author.",
      "items": {
        "$ref": "#/$defs/PackageType"
      }
    },
    "deprecation": {
      "$ref": "#/$defs/Deprecation"
    },
    "vulnerabilities": {
      "type": "array",
      "description": "Security vulnerabilities associated with this package version.",
      "items": {
        "$ref": "#/$defs/Vulnerability"
      }
    }
  },
  "$defs": {
    "PackageVersion": {
      "type": "object",
      "description": "A specific version of a package with its download count and registration leaf URL.",
      "required": ["version", "downloads"],
      "properties": {
        "@id": {
          "type": "string",
          "format": "uri",
          "description": "The absolute URL to the registration leaf for this version."
        },
        "version": {
          "type": "string",
          "description": "The full SemVer 2.0.0 version string."
        },
        "downloads": {
          "type": "integer",
          "minimum": 0,
          "description": "The number of downloads for this specific version."
        }
      }
    },
    "DependencyGroup": {
      "type": "object",
      "description": "A group of package dependencies applicable to a specific target framework.",
      "properties": {
        "targetFramework": {
          "type": "string",
          "description": "The target framework moniker. If absent, the group applies to all frameworks."
        },
        "dependencies": {
          "type": "array",
          "description": "The list of package dependencies in this group.",
          "items": {
            "$ref": "#/$defs/PackageDependency"
          }
        }
      }
    },
    "PackageDependency": {
      "type": "object",
      "description": "A dependency on another NuGet package.",
      "required": ["id"],
      "properties": {
        "id": {
          "type": "string",
          "description": "The package ID of the dependency."
        },
        "range": {
          "type": "string",
          "description": "The allowed version range for the dependency. Defaults to any version if absent."
        },
        "registration": {
          "type": "string",
          "format": "uri",
          "description": "The URL to the registration index for this dependency."
        }
      }
    },
    "PackageType": {
      "type": "object",
      "description": "A package type defined by the package author, such as Dependency or DotnetTool.",
      "required": ["name"],
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the package type."
        },
        "version": {
          "type": "string",
          "description": "The version of the package type. Only present if explicitly specified."
        }
      }
    },
    "Deprecation": {
      "type": "object",
      "description": "Deprecation information indicating a package should no longer be used.",
      "required": ["reasons"],
      "properties": {
        "reasons": {
          "type": "array",
          "description": "The reasons for deprecation.",
          "minItems": 1,
          "items": {
            "type": "string",
            "enum": ["Legacy", "CriticalBugs", "Other"]
          }
        },
        "message": {
          "type": "string",
          "description": "Additional details about the deprecation."
        },
        "alternatePackage": {
          "$ref": "#/$defs/AlternatePackage"
        }
      }
    },
    "AlternatePackage": {
      "type": "object",
      "description": "A recommended replacement package for a deprecated package.",
      "required": ["id"],
      "properties": {
        "id": {
          "type": "string",
          "description": "The ID of the alternate package."
        },
        "range": {
          "type": "string",
          "description": "The allowed version range, or * if any version is acceptable."
        }
      }
    },
    "Vulnerability": {
      "type": "object",
      "description": "A security vulnerability associated with a package version.",
      "required": ["advisoryUrl", "severity"],
      "properties": {
        "advisoryUrl": {
          "type": "string",
          "format": "uri",
          "description": "The URL to the security advisory for this vulnerability."
        },
        "severity": {
          "type": "string",
          "description": "The severity level: 0 = Low, 1 = Moderate, 2 = High, 3 = Critical.",
          "enum": ["0", "1", "2", "3"]
        }
      }
    }
  }
}
