feat(scalar): add API reference app

This commit is contained in:
okxlin
2026-07-19 17:32:55 +08:00
parent 6af1ea989e
commit 9ac3e4fcfe
19 changed files with 226 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
PANEL_APP_PORT_HTTP=8080
CONTAINER_NAME=
+19
View File
@@ -0,0 +1,19 @@
additionalProperties:
formFields:
- default: 8080
edit: true
envKey: PANEL_APP_PORT_HTTP
labelEn: HTTP Port
labelZh: HTTP 端口
label:
en: HTTP Port
zh: HTTP 端口
zh-Hant: HTTP 連接埠
ja: HTTP ポート
ko: HTTP 포트
ru: HTTP-порт
ms: Port HTTP
pt-br: Porta HTTP
required: true
rule: paramPort
type: number
+23
View File
@@ -0,0 +1,23 @@
openapi: 3.0.3
info:
title: Scalar API Reference Example
version: 1.0.0
description: A small OpenAPI document included to verify a fresh Scalar installation.
paths:
/health:
get:
operationId: getHealth
summary: Read the example health response
responses:
'200':
description: The example service is healthy.
content:
application/json:
schema:
type: object
required:
- status
properties:
status:
type: string
example: ok
+17
View File
@@ -0,0 +1,17 @@
services:
scalar:
image: "scalarapi/api-reference:0.5.58"
container_name: ${CONTAINER_NAME}
ports:
- "${PANEL_APP_PORT_HTTP}:8080"
volumes:
- ./data/docs:/docs:ro
labels:
createdBy: "Apps"
restart: unless-stopped
networks:
- 1panel-network
networks:
1panel-network:
external: true
View File
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
mkdir -p "$ROOT_DIR/data/docs"
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
docker-compose down --volumes
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -euo pipefail
exit 0
+48
View File
@@ -0,0 +1,48 @@
# Scalar API Reference
## 产品介绍
Scalar API Reference 从 OpenAPI 和 Swagger 规范提供交互式 API 参考文档。本应用使用
官方 `scalarapi/api-reference` 镜像及其 `/docs` 文档扫描机制。
## 主要功能
- 在浏览器中展示和交互浏览 OpenAPI 文档。
- 自动识别 `data/docs` 中的 JSON、YAML 和 YML 规范文件。
- 预置非敏感示例规范,首次安装后即可验证服务和文档扫描。
## 访问说明
- 安装后访问 `http://<服务器 IP>:<HTTP 端口>`。
- 首次安装包含一个示例 OpenAPI 文档,用于确认参考文档界面和文档扫描正常工作。
- 在应用安装目录的 `data/docs` 中添加或替换 `.json`、`.yaml` 或 `.yml`
OpenAPI 文件,然后重启应用。Scalar 会自动在页面中列出有效的规范文件。
- `data/docs` 为用户文档目录;卸载应用不会删除其中的文件。
## Usage
- Open `http://<server-ip>:<HTTP port>` after installation.
- The first installation includes a small OpenAPI example to verify the UI and
document scan without additional setup.
- Add or replace `.json`, `.yaml`, or `.yml` OpenAPI documents in the installed
app's `data/docs` directory, then restart the app. Scalar lists valid
specifications automatically.
- `data/docs` contains user documentation and is preserved on uninstall.
## Introduction
Scalar API Reference serves interactive API documentation from OpenAPI and
Swagger specifications. This package uses the official
`scalarapi/api-reference` image and its documented `/docs` document scan.
## Features
- Display and interact with OpenAPI documents in a browser.
- Discover JSON, YAML, and YML specification files in `data/docs`.
- Include a non-sensitive example specification so a new install can verify the
service and document scan immediately.
## Sources
- [Scalar Docker integration](https://scalar.com/products/api-references/integrations/docker)
- [Scalar source repository](https://github.com/scalar/scalar)
+30
View File
@@ -0,0 +1,30 @@
name: Scalar API Reference
tags:
- Tool
title: Scalar API 参考文档
description: Scalar API 参考文档
additionalProperties:
key: scalar
name: Scalar API Reference
tags:
- Tool
shortDescZh: Scalar API 参考文档
shortDescEn: Scalar API reference
description:
en: Serve interactive API reference documentation from OpenAPI specifications.
zh: 从 OpenAPI 规范提供交互式 API 参考文档。
zh-Hant: 從 OpenAPI 規範提供互動式 API 參考文件。
ja: OpenAPI 仕様から対話型 API リファレンスを提供します。
ko: OpenAPI 사양에서 대화형 API 참조 문서를 제공합니다.
ru: Предоставляет интерактивную справку API из спецификаций OpenAPI.
ms: Menyediakan rujukan API interaktif daripada spesifikasi OpenAPI.
pt-br: Disponibiliza referencia interativa de API a partir de especificacoes OpenAPI.
type: tool
crossVersionUpdate: true
limit: 0
website: https://scalar.com
github: https://github.com/scalar/scalar
document: https://scalar.com/products/api-references/integrations/docker
architectures:
- amd64
- arm64
+2
View File
@@ -0,0 +1,2 @@
PANEL_APP_PORT_HTTP=8080
CONTAINER_NAME=
+19
View File
@@ -0,0 +1,19 @@
additionalProperties:
formFields:
- default: 8080
edit: true
envKey: PANEL_APP_PORT_HTTP
labelEn: HTTP Port
labelZh: HTTP 端口
label:
en: HTTP Port
zh: HTTP 端口
zh-Hant: HTTP 連接埠
ja: HTTP ポート
ko: HTTP 포트
ru: HTTP-порт
ms: Port HTTP
pt-br: Porta HTTP
required: true
rule: paramPort
type: number
+23
View File
@@ -0,0 +1,23 @@
openapi: 3.0.3
info:
title: Scalar API Reference Example
version: 1.0.0
description: A small OpenAPI document included to verify a fresh Scalar installation.
paths:
/health:
get:
operationId: getHealth
summary: Read the example health response
responses:
'200':
description: The example service is healthy.
content:
application/json:
schema:
type: object
required:
- status
properties:
status:
type: string
example: ok
+17
View File
@@ -0,0 +1,17 @@
services:
scalar:
image: "scalarapi/api-reference:latest"
container_name: ${CONTAINER_NAME}
ports:
- "${PANEL_APP_PORT_HTTP}:8080"
volumes:
- ./data/docs:/docs:ro
labels:
createdBy: "Apps"
restart: unless-stopped
networks:
- 1panel-network
networks:
1panel-network:
external: true
View File
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
mkdir -p "$ROOT_DIR/data/docs"
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
docker-compose down --volumes
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -euo pipefail
exit 0
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB