Skip to content

docs(api): document /api/v1/ws chat WebSocket endpoint in openapi.yaml - #4215

Merged
diegosouzapw merged 1 commit into
release/v3.8.29from
docs/openapi-ws-endpoint
Jun 18, 2026
Merged

docs(api): document /api/v1/ws chat WebSocket endpoint in openapi.yaml#4215
diegosouzapw merged 1 commit into
release/v3.8.29from
docs/openapi-ws-endpoint

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Problema

Na página API Endpoints do dashboard faltava a referência do WebSocket de chat (compatível com OpenAI). A página renderiza /api/openapi/spec (parseado de docs/reference/openapi.yaml), e o endpoint /api/v1/ws (src/app/api/v1/ws/route.ts, no projeto desde v3.6.6 / #1241) nunca foi listado no openapi.yaml.

Diagnóstico (não assumi): via git log -S "/v1/ws" -- docs/reference/openapi.yamlvazio. Ou seja, não foi uma regressão ("não saiu") — nunca existiu na spec. Conforme combinado ("se nunca existiu, coloque lá"), este PR adiciona a referência.

O que foi adicionado

Entrada /api/v1/ws (GET) no openapi.yaml, seguindo o padrão do WS já documentado (traffic-inspector/ws):

  • Handshake ?handshake=1 → descritor JSON da conexão (auth path, protocolo de mensagens, canais live).
  • Upgrade: 426 Upgrade Required sem upgrade; 101 no sucesso.
  • Protocolo de frames JSON: {type:"request", id, payload:{model, messages}} e {type:"cancel", id}.
  • Canal live (LIVE_WS_PORT/20129, path /live, tópicos requests/combo/credentials, heartbeat 15s).
  • Auth: BearerAuth (api-key); respostas 401/403.

Validação

  • TDD (tests/unit/openapi-ws-endpoint.test.ts, RED→GREEN): parseia a spec e trava o endpoint + tag/auth/respostas (101/426). RED comprovado revertendo o yaml.
  • Gates verdes: check-openapi-routes (196 paths, rota real existe), -coverage, -security-tiers (BearerAuth bate com routeGuard.ts — não é loopback-only), -breaking (adição não-breaking), check-docs-sync, check-fabricated-docs, ESLint, file-size.

Frente D do pedido do MiniMax — encerra as 5 frentes (A análise, B/C media #4212, E hover #4214, D este).

The OpenAI-compatible chat WebSocket (src/app/api/v1/ws/route.ts, shipped in
v3.6.6) was never listed in openapi.yaml, so it was invisible on the dashboard's
"API Endpoints" page — which renders /api/openapi/spec, parsed from this file.
Verified via git history (pickaxe): the path never existed in the spec, so this
adds it rather than restoring a regression.

Documents the GET handshake (`?handshake=1` → JSON connection descriptor) and the
upgrade flow (426 without upgrade; 101 on success), the JSON frame protocol
(`{type:"request"|"cancel", ...}`), the live-event channel (LIVE_WS_PORT/20129),
and BearerAuth. Follows the existing WS doc pattern (traffic-inspector/ws).

Regression test parses the spec and pins the endpoint + its auth/responses.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw
diegosouzapw merged commit fe54821 into release/v3.8.29 Jun 18, 2026
4 checks passed
@diegosouzapw diegosouzapw mentioned this pull request Jun 19, 2026
@diegosouzapw
diegosouzapw deleted the docs/openapi-ws-endpoint branch June 19, 2026 12:06
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.

1 participant