Commit graph

1 commit

Author SHA1 Message Date
diegosouzapw
9638a88145 feat(docs-ui): generate openapi module from yaml + ApiExplorer consumes it
- scripts/docs/gen-openapi-module.mjs (new): build helper that loads
  docs/reference/openapi.yaml via js-yaml, flattens paths × methods, and
  emits src/app/docs/lib/openapi.generated.ts with strongly-typed
  OPENAPI_ENDPOINTS, OPENAPI_TAGS, OPENAPI_VERSION, OPENAPI_TITLE plus
  the OpenApiEndpoint interface (no `any`, deterministic ordering).
  By default it skips internal management paths (anything under /api/
  that isn't /api/v1/*) so the Api Explorer focuses on the OpenAI-
  compatible public surface — 19 endpoints for v3.8.0 (Chat, Messages,
  Responses, Embeddings, Images, Audio, Moderations, Rerank, Models,
  System). Add --include-management to emit all 121 paths if needed.
- src/app/docs/components/ApiExplorerClient.tsx: drop the 13-entry
  hardcoded API_ENDPOINTS array; the component now imports from
  @/app/docs/lib/openapi.generated. Tags come from the spec; the
  "Try It" form picks an example body keyed by full path (8 well-known
  bodies pre-seeded, everything else starts empty). The header pill
  now shows endpoint count + OpenAPI version, and an "auth" pill is
  rendered next to operations whose spec declares non-empty security.
- package.json: prebuild:docs now chains gen-openapi-module after the
  docs index generator so `next build` always sees a fresh module.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 18:57:12 -03:00