feat(openapi): integrate springdoc and API integration guide
- add springdoc-openapi and expose /v3/api-docs, /v3/api-docs.yaml and Swagger UI - keep API docs responses unwrapped by replacing the global return handler - add Chinese @Tag/@Operation/@Parameter docs for file and async task controllers - add docs/api-integration.md and local export scripts for AI agent consumption - ignore local OpenAPI snapshots and force LF for shell scripts
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
# 导出本地 OpenAPI 文档。
|
||||
#
|
||||
# 用法:
|
||||
# scripts/export-openapi.sh [baseUrl] [outFile]
|
||||
#
|
||||
# 输出文件扩展名为 .json 时导出 JSON,否则导出 YAML。
|
||||
# 生成的文件已被 .gitignore 忽略,不会提交。
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
BASE_URL="${1:-http://localhost:18092}"
|
||||
OUT_FILE="${2:-$ROOT_DIR/docs/openapi.local.yaml}"
|
||||
|
||||
BASE_URL="${BASE_URL%/}"
|
||||
mkdir -p "$(dirname "$OUT_FILE")"
|
||||
|
||||
case "$OUT_FILE" in
|
||||
*.json)
|
||||
API_PATH="/v3/api-docs"
|
||||
;;
|
||||
*)
|
||||
API_PATH="/v3/api-docs.yaml"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Fetching ${BASE_URL}${API_PATH}"
|
||||
curl -fsS "${BASE_URL}${API_PATH}" -o "$OUT_FILE"
|
||||
echo "OpenAPI exported to $OUT_FILE"
|
||||
Reference in New Issue
Block a user