docs(api): document /api/v1/ws chat WebSocket endpoint in openapi.yaml - #4215
Merged
Conversation
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.
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 dedocs/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 noopenapi.yaml.Diagnóstico (não assumi): via
git log -S "/v1/ws" -- docs/reference/openapi.yaml→ vazio. 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) noopenapi.yaml, seguindo o padrão do WS já documentado (traffic-inspector/ws):?handshake=1→ descritor JSON da conexão (auth path, protocolo de mensagens, canais live).426 Upgrade Requiredsem upgrade;101no sucesso.{type:"request", id, payload:{model, messages}}e{type:"cancel", id}.LIVE_WS_PORT/20129, path/live, tópicos requests/combo/credentials, heartbeat 15s).BearerAuth(api-key); respostas401/403.Validação
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.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).