[PR #6430] [MERGED] docs(api): mark collection responses nullable #6266

Closed
opened 2026-11-02 04:07:32 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6430
Author: @LineGM
Created: 9/7/2026
Status: ✅ Merged
Merged: 9/8/2026
Merged by: @MHSanaei

Base: main ← Head: docs/nullable-collection-responses


📝 Commits (2)

  • 8e3a788 docs(api): mark collection responses nullable
  • 54278e3 docs(api): include nullable Xray log responses

📊 Changes

5 files changed (+46 additions, -5 deletions)

View changed files

📝 docs/public/openapi.json (+9 -1)
📝 frontend/public/openapi.json (+9 -1)
📝 frontend/scripts/build-openapi.mjs (+7 -1)
📝 frontend/src/pages/api-docs/endpoints.ts (+4 -1)
📝 frontend/src/test/openapi-runtime-contracts.test.ts (+17 -1)

📄 Description

Summary

Document three existing nullable collection responses in OpenAPI:

  • GET /panel/api/inbounds/allLinks: string[] | null.
  • POST /panel/api/server/logs/{count}: string[] | null.
  • POST /panel/api/server/xraylogs/{count}: LogEntry[] | null.

Add opt-in nullable support for generated response arrays, preserving the Xray log example generated from LogEntry, and regression coverage for all three contracts.

Runtime behavior remains unchanged.

Why

Related to #6411.

These endpoints can return a nil Go slice, which the panel envelope serializes as "obj": null, including successful empty responses. OpenAPI previously left the allLinks response object unconstrained and described both log responses as non-nullable arrays. Explicit nullable array schemas let generated clients account for the existing wire format. Other generated array schemas retain their current nullability.

Type of change

  • Documentation
  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (API documentation metadata and regression tests)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

How was this tested?

Local toolchains: Node 24.20.0, Go 1.27.1, pnpm 11.25.0 (via Corepack).

  • cd frontend && npm test -- src/test/openapi-runtime-contracts.test.ts src/test/openapi-request-bodies.test.ts: 2 files / 7 tests passed. All three affected schema assertions were confirmed failing before their fixes; the Xray log test also verifies the generated example is preserved.
  • cd frontend && npm run format:check && npm run lint && npm run typecheck: passed.
  • make gen: passed; repeated generation produced an identical diff.
  • cp frontend/public/openapi.json docs/public/openapi.json and cd docs && pnpm gen:api: completed. MDX regeneration produced no changes.
  • cd docs && pnpm format:check && pnpm lint && pnpm typecheck && pnpm test: passed (12 test files, 106 tests).
  • cmp frontend/public/openapi.json docs/public/openapi.json and git diff --check: passed.

Full make verify is left to GitHub Actions. The diff contains only API metadata, the OpenAPI generator, regression tests, and the two generated OpenAPI copies; no Go or frontend runtime changes.

Breaking changes

None.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally.
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass.
  • I updated the Wiki / README / API docs if user-facing behavior changed.
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6430 **Author:** [@LineGM](https://github.com/LineGM) **Created:** 9/7/2026 **Status:** ✅ Merged **Merged:** 9/8/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `docs/nullable-collection-responses` --- ### 📝 Commits (2) - [`8e3a788`](https://github.com/MHSanaei/3x-ui/commit/8e3a78898e4b679e1bef3f502a9c03caaf714676) docs(api): mark collection responses nullable - [`54278e3`](https://github.com/MHSanaei/3x-ui/commit/54278e33a049d86611f8f5110abac66218cc8c10) docs(api): include nullable Xray log responses ### 📊 Changes **5 files changed** (+46 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `docs/public/openapi.json` (+9 -1) 📝 `frontend/public/openapi.json` (+9 -1) 📝 `frontend/scripts/build-openapi.mjs` (+7 -1) 📝 `frontend/src/pages/api-docs/endpoints.ts` (+4 -1) 📝 `frontend/src/test/openapi-runtime-contracts.test.ts` (+17 -1) </details> ### 📄 Description ## Summary Document three existing nullable collection responses in OpenAPI: - `GET /panel/api/inbounds/allLinks`: `string[] | null`. - `POST /panel/api/server/logs/{count}`: `string[] | null`. - `POST /panel/api/server/xraylogs/{count}`: `LogEntry[] | null`. Add opt-in nullable support for generated response arrays, preserving the Xray log example generated from `LogEntry`, and regression coverage for all three contracts. Runtime behavior remains unchanged. ## Why Related to #6411. These endpoints can return a nil Go slice, which the panel envelope serializes as `"obj": null`, including successful empty responses. OpenAPI previously left the allLinks response object unconstrained and described both log responses as non-nullable arrays. Explicit nullable array schemas let generated clients account for the existing wire format. Other generated array schemas retain their current nullability. ## Type of change - [x] Documentation - [ ] Bug fix - [ ] New feature - [ ] Refactoring (no behavior change) - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [x] Frontend (API documentation metadata and regression tests) - [ ] Backend (API endpoints, login, settings) - [ ] Xray config generation - [ ] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [ ] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? Local toolchains: Node 24.20.0, Go 1.27.1, pnpm 11.25.0 (via Corepack). - `cd frontend && npm test -- src/test/openapi-runtime-contracts.test.ts src/test/openapi-request-bodies.test.ts`: 2 files / 7 tests passed. All three affected schema assertions were confirmed failing before their fixes; the Xray log test also verifies the generated example is preserved. - `cd frontend && npm run format:check && npm run lint && npm run typecheck`: passed. - `make gen`: passed; repeated generation produced an identical diff. - `cp frontend/public/openapi.json docs/public/openapi.json` and `cd docs && pnpm gen:api`: completed. MDX regeneration produced no changes. - `cd docs && pnpm format:check && pnpm lint && pnpm typecheck && pnpm test`: passed (12 test files, 106 tests). - `cmp frontend/public/openapi.json docs/public/openapi.json` and `git diff --check`: passed. Full `make verify` is left to GitHub Actions. The diff contains only API metadata, the OpenAPI generator, regression tests, and the two generated OpenAPI copies; no Go or frontend runtime changes. ## Breaking changes None. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [ ] `go build ./...` and the test suite pass locally. - [ ] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. - [x] I updated the Wiki / README / API docs if user-facing behavior changed. - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:07:32 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6266
No description provided.