mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6409] [MERGED] docs(api): align OpenAPI with runtime contracts #6256
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6256
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6409
Author: @LineGM
Created: 9/4/2026
Status: ✅ Merged
Merged: 9/4/2026
Merged by: @MHSanaei
Base:
main← Head:docs/openapi-runtime-contracts📝 Commits (1)
d7130d7docs(api): align OpenAPI with runtime contracts📊 Changes
20 files changed (+4681 additions, -607 deletions)
View changed files
📝
docs/content/docs/en/reference/api/server.mdx(+8 -12)📝
docs/content/docs/en/reference/api/subscription-server.mdx(+22 -1)📝
docs/public/openapi.json(+1557 -234)📝
frontend/public/openapi.json(+1557 -234)📝
frontend/scripts/build-openapi.mjs(+32 -16)📝
frontend/src/generated/examples.ts(+120 -0)📝
frontend/src/generated/schemas.ts(+382 -0)📝
frontend/src/generated/types.ts(+82 -0)📝
frontend/src/generated/zod.ts(+91 -0)📝
frontend/src/pages/api-docs/ApiDocsPage.css(+23 -0)📝
frontend/src/pages/api-docs/ApiDocsPage.tsx(+25 -1)📝
frontend/src/pages/api-docs/endpoints.ts(+147 -50)➕
frontend/src/pages/api-docs/websocket-events.ts(+325 -0)➕
frontend/src/test/openapi-runtime-contracts.test.ts(+228 -0)📝
internal/web/routes_contract_test.go(+1 -1)📝
internal/web/service/client_paging.go(+30 -30)📝
internal/web/service/inbound_traffic.go(+5 -5)📝
internal/web/service/server.go(+32 -18)📝
internal/xray/traffic.go(+5 -5)📝
tools/openapigen/main.go(+9 -0)📄 Description
Summary
GET /wsupgrade path.Why
The API documentation had drifted from runtime behavior: it exported invalid pseudo WebSocket paths and a
wsmethod, used the wrong envelope/event names, advertised stale REST response shapes, omitted client paging filters/sort keys, and missed registered subscriptionHEADroutes.This is documentation/tooling alignment only. It does not change
allLinksor other runtime response behavior.Type of change
Areas affected
How was this tested?
The new
buildSpec()regression test was first run against the old implementation and failed all five contract groups. It now passes.npm test -- src/test/openapi-runtime-contracts.test.ts --project unitnpm run format:checknpm run lintnpm run typechecknpm run buildgo test -p 1 ./tools/openapigengo test -p 1 ./internal/web/servicego test -p 1 ./internal/web/controllergo test -p 1 ./internal/xraymake gen(run twice; generated diff hash was identical)cd docs && corepack pnpm install --frozen-lockfilecd docs && corepack pnpm gen:apicd docs && corepack pnpm format:checkcd docs && corepack pnpm lintcd docs && corepack pnpm typecheckcd docs && corepack pnpm test(106 tests)git diff --checkThe full
make verifyis left to GitHub Actions as requested by the repository workflow.Screenshots / recordings
WebSocket event cards use the same responsive Ant Design
Row/Col/Cardlayout as the existing panel pages. Long examples scroll inside the code block.Breaking changes
None.
Checklist
go build ./...and the test suite pass locally. (Full verification is left to GitHub Actions.)npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.