1
0
Fork 1
mirror of https://github.com/git-pkgs/proxy.git synced 2026-07-06 22:33:19 -04:00
pkg-proxy/docs/swagger/swagger.json
Andrew Nesbitt 08d975c397
Mount web UI under /ui (#148)
* Mount web UI under /ui (closes #123)

The UI now lives under /ui so reverse proxies can apply different
access rules to it (e.g. require auth) while leaving the package
endpoints (/npm, /pypi, /v2, ...) open to build machines.

- GET / redirects to /ui/
- /api/browse and /api/compare move to /ui/api/browse and
  /ui/api/compare since only the browser JS calls them
- /health, /stats, /metrics, /openapi.json and /api/* stay at root

* README: nginx example for splitting UI auth from package endpoints

The /ui prefix lets a reverse proxy apply different access rules to the
web UI than to the package endpoints. Adds the snippet that motivated
the prefix change so deployers don't have to derive it.
2026-06-07 15:47:29 +01:00

752 lines
No EOL
24 KiB
JSON

{
"swagger": "2.0",
"info": {
"description": "HTTP API for package enrichment, vulnerability lookup, cache stats, and source browsing.",
"title": "git-pkgs proxy API",
"contact": {},
"version": "0.1.0"
},
"basePath": "/",
"paths": {
"/api/bulk": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"api"
],
"summary": "Bulk package lookup by PURL",
"parameters": [
{
"description": "PURLs",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/server.BulkRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/server.BulkResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
}
}
}
},
"/api/outdated": {
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"api"
],
"summary": "Check outdated packages",
"parameters": [
{
"description": "Packages to check",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/server.OutdatedRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/server.OutdatedResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
}
}
}
},
"/api/packages": {
"get": {
"produces": [
"application/json"
],
"tags": [
"api"
],
"summary": "List cached packages",
"parameters": [
{
"type": "string",
"description": "Ecosystem",
"name": "ecosystem",
"in": "query"
},
{
"enum": [
"hits",
"name",
"size",
"cached_at",
"ecosystem",
"vulns"
],
"type": "string",
"description": "Sort",
"name": "sort",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/server.PackagesListResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
}
}
}
},
"/api/search": {
"get": {
"produces": [
"application/json"
],
"tags": [
"api"
],
"summary": "Search cached packages",
"parameters": [
{
"type": "string",
"description": "Query",
"name": "q",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Ecosystem",
"name": "ecosystem",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/server.SearchResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
}
}
}
},
"/health": {
"get": {
"produces": [
"application/json"
],
"tags": [
"meta"
],
"summary": "Health check",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/server.HealthResponse"
}
},
"503": {
"description": "Service Unavailable",
"schema": {
"$ref": "#/definitions/server.HealthResponse"
}
}
}
}
},
"/stats": {
"get": {
"produces": [
"application/json"
],
"tags": [
"meta"
],
"summary": "Cache statistics",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/server.StatsResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
}
}
}
},
"/ui/api/browse/{ecosystem}/{name}/{version}": {
"get": {
"description": "Lists files from the first cached artifact for a package version.",
"produces": [
"application/json"
],
"tags": [
"browse"
],
"summary": "List files inside a cached artifact",
"parameters": [
{
"type": "string",
"description": "Ecosystem",
"name": "ecosystem",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Package name",
"name": "name",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Version",
"name": "version",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Directory path inside the archive",
"name": "path",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/server.BrowseListResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
}
}
}
},
"/ui/api/browse/{ecosystem}/{name}/{version}/file/{filepath}": {
"get": {
"description": "Streams a single file from the cached artifact. The file path may contain slashes.",
"produces": [
"application/octet-stream"
],
"tags": [
"browse"
],
"summary": "Fetch a file inside a cached artifact",
"parameters": [
{
"type": "string",
"description": "Ecosystem",
"name": "ecosystem",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Package name",
"name": "name",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Version",
"name": "version",
"in": "path",
"required": true
},
{
"type": "string",
"description": "File path inside the archive",
"name": "filepath",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
}
}
}
},
"/ui/api/compare/{ecosystem}/{name}/{fromVersion}/{toVersion}": {
"get": {
"description": "Returns a structured diff for two cached versions.",
"produces": [
"application/json"
],
"tags": [
"browse"
],
"summary": "Compare two cached versions",
"parameters": [
{
"type": "string",
"description": "Ecosystem",
"name": "ecosystem",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Package name",
"name": "name",
"in": "path",
"required": true
},
{
"type": "string",
"description": "From version",
"name": "fromVersion",
"in": "path",
"required": true
},
{
"type": "string",
"description": "To version",
"name": "toVersion",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ErrorResponse"
}
}
}
}
}
},
"definitions": {
"server.BrowseFileInfo": {
"type": "object",
"properties": {
"is_dir": {
"type": "boolean"
},
"mod_time": {
"type": "string"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"size": {
"type": "integer"
}
}
},
"server.BrowseListResponse": {
"type": "object",
"properties": {
"files": {
"type": "array",
"items": {
"$ref": "#/definitions/server.BrowseFileInfo"
}
},
"path": {
"type": "string"
}
}
},
"server.BulkRequest": {
"type": "object",
"properties": {
"purls": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"server.BulkResponse": {
"type": "object",
"properties": {
"packages": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/server.PackageResponse"
}
}
}
},
"server.ErrorResponse": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
}
},
"server.HealthCheck": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"status": {
"type": "string"
},
"step": {
"type": "string"
}
}
},
"server.HealthResponse": {
"type": "object",
"properties": {
"checks": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/server.HealthCheck"
}
},
"status": {
"type": "string"
}
}
},
"server.OutdatedPackage": {
"type": "object",
"properties": {
"ecosystem": {
"type": "string"
},
"name": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"server.OutdatedRequest": {
"type": "object",
"properties": {
"packages": {
"type": "array",
"items": {
"$ref": "#/definitions/server.OutdatedPackage"
}
}
}
},
"server.OutdatedResponse": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/server.OutdatedResult"
}
}
}
},
"server.OutdatedResult": {
"type": "object",
"properties": {
"ecosystem": {
"type": "string"
},
"is_outdated": {
"type": "boolean"
},
"latest_version": {
"type": "string"
},
"name": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"server.PackageListResult": {
"type": "object",
"properties": {
"cached_at": {
"type": "string"
},
"ecosystem": {
"type": "string"
},
"hits": {
"type": "integer"
},
"latest_version": {
"type": "string"
},
"license": {
"type": "string"
},
"license_category": {
"type": "string"
},
"name": {
"type": "string"
},
"size": {
"type": "integer"
},
"vuln_count": {
"type": "integer"
}
}
},
"server.PackageResponse": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"ecosystem": {
"type": "string"
},
"homepage": {
"type": "string"
},
"latest_version": {
"type": "string"
},
"license": {
"type": "string"
},
"license_category": {
"type": "string"
},
"name": {
"type": "string"
},
"registry_url": {
"type": "string"
},
"repository": {
"type": "string"
}
}
},
"server.PackagesListResponse": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"ecosystem": {
"type": "string"
},
"page": {
"type": "integer"
},
"per_page": {
"type": "integer"
},
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/server.PackageListResult"
}
},
"sort_by": {
"type": "string"
},
"total": {
"type": "integer"
}
}
},
"server.SearchPackageResult": {
"type": "object",
"properties": {
"cached_at": {
"type": "string"
},
"ecosystem": {
"type": "string"
},
"hits": {
"type": "integer"
},
"latest_version": {
"type": "string"
},
"license": {
"type": "string"
},
"name": {
"type": "string"
},
"size": {
"type": "integer"
}
}
},
"server.SearchResponse": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"query": {
"type": "string"
},
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/server.SearchPackageResult"
}
}
}
},
"server.StatsResponse": {
"type": "object",
"properties": {
"cached_artifacts": {
"type": "integer"
},
"database_path": {
"type": "string"
},
"storage_url": {
"type": "string"
},
"total_size": {
"type": "string"
},
"total_size_bytes": {
"type": "integer"
}
}
}
}
}