Repository navigation
Serve the API reference from Speculoos - #337
Conversation
- The page body fills its width: its Box was a flex child with no width, so it shrank to its content and the layout jumped from page to page. - Type errors in LinkCard, Tabs and remark-admonition. The controlled Tabs root drops a defaultValue that Radix ignores. - Radix Code drops Infima's leftover border and vertical-align once, in reset.css, rather than inline in CodeInline; inline code and admonitions use the outline variant. - The Management API's path is /v1/api-keys in the temporary key examples; a guide's link to the Realtime reference drops its .mdx. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
spec/mp.yaml is now the public spec generated upstream (make public-spec in the Management Platform repo): OpenAPI 3, with the server, authentication and the descriptions ported upstream from this repo's old copy. generate-mp-spec.ts reads it as OpenAPI 3: it names its own server, and the schema titles go on components.schemas. The new summaries rename one page: post-a-new-project is now create-a-project, with a redirect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every Batch operation has JavaScript, Python and curl samples, and every Management operation a curl sample. One injector (scripts/code-samples/ inject.ts) adds them to both specs as x-codeSamples, which the reference renders as tabs. npm run test:code-samples runs each one against a mock built from the spec: requests are checked against the operation's schemas, and the mock answers with the spec's own examples. The Batch API's comes from an OpenAPI 3.1 copy (generate-openapi.ts converts static/batch.yaml and applies spec/batch.overlay.yaml, which adds a success example per operation and what Swagger 2.0 cannot express). The workflow runs the tests on any change to the specs, the samples or the harness, with a read-only token and no secrets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every reference page is now rendered by Speculoos from IR built at build time (npm run build:speculoos-ir): one page per REST operation or WebSocket channel, written by scripts/generate-speculoos-pages.ts. - The Realtime spec is canonical AsyncAPI 3, with its authentication and handshake declared; the Agent STT spec is generated from it. - Batch renders from the OpenAPI 3.1 copy the code-sample tests read; Management from the public spec. - A panel beside each entry: a channel's session as a sequence diagram, or an operation's code samples and examples. Below lg a REST panel follows the entry and a session comes first, collapsed. - <Schema> puts the same field tables in guides, headed by the type's name and a link to where the reference uses it. - The site's Markdown component moves to src/components, on react-markdown 10. - The OpenAPI plugin and theme, the AsyncAPI loader, the old WebSocket pages and their generator go. Renamed and removed pages redirect; message anchors are now kebab-case (#start-recognition). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dumitrugutu
left a comment
There was a problem hiding this comment.
I left some comments--mainly because I'm unfamiliar with the generator tool, but overall LGTM!
| @@ -0,0 +1,23 @@ | |||
| {/* | |||
There was a problem hiding this comment.
do we need a separate file for stt? looks identical to docs/api-ref/_realtime-connection-close.mdx
There was a problem hiding this comment.
They were previously documented separately. I suspect they are the same but didn't want to assume in case things change. Maybe later we can see about consolidating this elsewhere.
| @@ -0,0 +1,58 @@ | |||
| {/* Agent STT handshake responses, for the end of the reference's Handshake section. */} | |||
There was a problem hiding this comment.
same question here, do we need this file for stt? looks identical to docs/api-ref/_realtime-handshake-responses.mdx
There was a problem hiding this comment.
The main difference is the path /v2/agents. I'm keeping it as close to it was previously as possible, but maybe we can consolidate this in the future.
| import SchemaNode from "@theme/Schema"; | ||
| import batchSpec from "!openapi-schema-loader!@site/spec/batch.yaml"; | ||
| import { Schema } from "@site/src/components/Speculoos"; | ||
| import batch from "@site/src/generated/batch.ir.json"; |
There was a problem hiding this comment.
what is their extension?
There was a problem hiding this comment.
The ir stands for intermediate representation. All it means is the JSON file follows the Speculoos schema. It could be named whatever we want (something like batch.speculoos.json might be clearer?)
| SpeakersResult: | ||
| $ref: "#/components/messages/SpeakersResult" | ||
| operations: | ||
| publish: |
There was a problem hiding this comment.
nit: I liked the separation of messages between server and client but it appears that is no longer an option in v3?
There was a problem hiding this comment.
We still have the split, we've just refactored how it's communicated. Previously it was written from the client perspective, which was apparently against AsyncAPI convention. This creates two operations: receiveClientMessages and sendServerMessages. Same idea but written from the server's perspective and explicitly labeled.
…240) - `real-time-client`: Update models based on latest upstream spec - Spec was refactored in speechmatics/docs#337 to include two operations on a shared channel - Updated `generate-models.ts` to generate the same types based on this new spec, including some workarounds for a bug in Modelina preventing union creation by operation instead of channel - Bump versions
Stack 4 of 4, splitting #331 for review. Based on #336.
When the stack is merged,
mainmatches #331's branch, minusSPECULOOS-PLAN.md(deleted here).What changes
Every API reference page is rendered by Speculoos (
0.1.0-alpha.1) from IR built at build time (npm run build:speculoos-ir, wired intostartandbuild).scripts/generate-speculoos-pages.tswrites one page per REST operation or WebSocket channel into gitignored directories, which the sidebar lists withautogenerated. A page's own prose, which the spec can't express (handshake responses, how a connection closes), lives in partials beside the pages.Specs
Rendering (
src/components/Speculoos/)site.tsx: how this site renders Speculoos. That's the Radix Themes map, with the site's Markdown, the sidebar's badge colours, and types expanded where they're used.SessionPanel.tsx: a channel's session as a compact sequence diagram beside the reference, with each message linking to its section and showing its example on hover. Belowlgit comes first, collapsed.OperationPanel.tsx: an operation's code samples, then its examples, each labelled by its status's description ("400 Bad request").Schema.tsx:<Schema>puts the same field tables in guides, headed by the type's name and a link to where the reference uses it.openopens one field among the rest. The Batch and Realtime guides use it in place of the oldSchemaNodeand AsyncAPI loader.src/components/Markdown, onreact-markdown10 withremark-gfm4 andrehype-raw7.Removed: the OpenAPI plugin and theme, its templates and the sidebar filter for Batch paths, the
Schema/SchemaItemtheme components, the AsyncAPI and OpenAPI schema loaders, and the old WebSocket pages with their generator.Worth reviewing
post-a-new-project(from Build the Management reference from the public spec #335) are all inredirects.json/vercel.json.#startrecognition→#start-recognition). In-repo links are updated, but external deep links to the old anchors will land at the top of the page; redirects can't cover fragments.src/generatedare produced by the build, not committed.npm run speculoos:localtries local packs of the Speculoos repo.Checked
npm run buildpasses, with no broken links.tscpasses once the build has generatedsrc/generated.npm run test:code-samples: all 24 samples pass.Closes #331 once the stack lands.
🤖 Generated with Claude Code