Skip to content

Add HTTP API endpoint index in API Reference#342

Closed
xiaobo-gaga wants to merge 6 commits intomainfrom
feat/http-api-reference-rebuild
Closed

Add HTTP API endpoint index in API Reference#342
xiaobo-gaga wants to merge 6 commits intomainfrom
feat/http-api-reference-rebuild

Conversation

@xiaobo-gaga
Copy link
Collaborator

@xiaobo-gaga xiaobo-gaga commented Feb 27, 2026

This starts rebuilding HTTP API discoverability in API Reference by reverse-mapping current SDK-linked docs.

Changes:

  • Add http-api-endpoints page under API Reference in:
    • English
    • Simplified Chinese
    • Traditional Chinese (HK)
  • Each page includes method + URL + SDK method + detailed doc link.
  • Covers trade + quote + watchlist HTTP endpoints currently documented with explicit HTTP blocks.

Why:

  • /docs currently feels SDK-oriented; HTTP APIs are hard to find from the API Reference entry.
  • This provides a single searchable entry point before we continue full endpoint-level normalization.

Next step (follow-up PR):

  • auto-generate parameter snapshots from SDK/protocol definitions and attach to each endpoint entry.

@xiaobo-gaga
Copy link
Collaborator Author

Implemented as requested: introduced an OpenAPI-based validation pipeline baseline.

Added:

  • openapi/openapi.baseline.json (OpenAPI 3.1 baseline)
  • script/generate-cases-from-openapi.mjs (generate validation cases from OpenAPI)
  • script/validate-http-apis.mjs (runtime validator against openapi.longbridge.xyz with OAuth2 support)
  • script/README-openapi-validation.md
  • npm scripts:
    • npm run generate:api-cases
    • npm run validate:apis

Validated now:

  • GET /v1/test
  • OAuth discovery endpoint
  • auth-required endpoint unauthorized behavior (/v1/asset/account)

Result:

  • OpenAPI contract can now drive executable validation cases.
  • Future doc updates can be gated by: update OpenAPI -> generate cases -> run validation -> attach evidence in PR.

@xiaobo-gaga
Copy link
Collaborator Author

已补上 CI 验证流程:

  • 新增 workflow: .github/workflows/api-validation.yml
  • 触发条件:PR / push / 手动触发(涉及 docs/openapi/script 变更时自动执行)
  • 执行步骤:
    1. bun install
    2. bun run generate:api-cases
    3. bun run validate:apis
  • 默认校验目标:https://openapi.longbridge.xyz(仅用于脚本验证)

可选 Secrets(用于鉴权接口验证增强):

  • OPENAPI_ACCESS_TOKEN
  • OPENAPI_CLIENT_ID
  • OPENAPI_CLIENT_SECRET
  • OPENAPI_REFRESH_TOKEN
  • OPENAPI_REDIRECT_URI
  • OPENAPI_AUTH_CODE

当前即使未配置 secrets,也会执行基础与未授权场景校验,确保 CI 不空跑。

@xiaobo-gaga
Copy link
Collaborator Author

Implemented based on the old ?mode=try-it mechanism:

  • Added per-API split script: script/split-tryit-apis.ts
  • Added command: bun run split:tryit-apis
  • Added docs: script/README-tryit-split.md
  • Wired into CI (api-validation.yml):
    1. split Try-It APIs from docs
    2. generate OpenAPI-based validation cases
    3. run API validation
    4. upload split JSON artifacts (openapi/tryit/*.json)

This makes each documented API an explicit unit for future per-API implementation and validation expansion.

@xiaobo-gaga
Copy link
Collaborator Author

Implemented a Mintlify-style API Reference catalog view (one-by-one API list) on docs pages.

Added:

  • docs/en/docs/api-reference/endpoints.md
  • docs/zh-CN/docs/api-reference/endpoints.md
  • docs/zh-HK/docs/api-reference/endpoints.md

What it does:

  • Lists concrete APIs one-by-one (method + path)
  • Links to each detailed API doc
  • Provides direct Try-It links (?mode=try-it)
  • Groups by path domain (TRADE / QUOTE / ASSET / WATCHLIST ...)

Also added generator + CI wiring:

  • script/generate-api-endpoints-catalog.ts
  • bun run generate:api-catalog
  • CI now runs catalog generation in api-validation.yml

And made API Reference section expanded by default in sidebar (collapsed: false).

@huacnlee huacnlee closed this Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants