Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
1d593a0
feat(api-reference): render the REST API reference with fumadocs-openapi
nickvigilante Oct 28, 2026
c4bfa81
fix(api-reference): reject external $refs and read swagger.json like …
nickvigilante Oct 28, 2026
c2f01d2
fix(api-reference): pass the axe pass on the API pages
nickvigilante Oct 28, 2026
6168236
fix(docs-theme): recolour API links under More contrast without touch…
nickvigilante Oct 28, 2026
edf5a68
fix(api-reference): escape backslashes and Markdown syntax in operati…
nickvigilante Oct 28, 2026
9ffecca
feat(api-reference): show a copyable curl command instead of the play…
nickvigilante Oct 28, 2026
c8ef253
feat(api-reference): bring back the playground beside the curl sample
nickvigilante Oct 28, 2026
d3fcc4b
fix(ci): omit empty pr_number meta from preview deploys
nickvigilante Oct 28, 2026
e4b8377
feat(api-reference): show code samples in curl, JavaScript, Python an…
nickvigilante Oct 28, 2026
00d053c
feat(api-reference): show each operation's method badge in the sidebar
nickvigilante Oct 28, 2026
b3f81c3
feat(api-reference): set-up section and operation cards on the API la…
nickvigilante Oct 28, 2026
613dbf3
fix(api-reference): name the playground's language select and recolou…
nickvigilante Oct 28, 2026
faa80fc
feat(api-reference): hide the API playground for now
nickvigilante Oct 28, 2026
f80851d
Merge remote-tracking branch 'origin/main' into vigilante/docs-1431-o…
nickvigilante Oct 28, 2026
6f04ff7
fix(api-reference): stop a bad stored server URL from crashing operat…
nickvigilante Oct 28, 2026
b928dd2
fix(api-reference): keep curl's @file argument out of the version-seg…
nickvigilante Oct 28, 2026
297dbdb
fix(api-reference): trim the landing page's end without a backtrackin…
nickvigilante Oct 28, 2026
52aced8
refactor(api-reference): move the sync's Swagger reading and referenc…
nickvigilante Oct 28, 2026
3ee6ec3
fix(api-reference): fold an older Swagger document's basePath into it…
nickvigilante Oct 28, 2026
9273ff9
feat(api-reference): render the generated reference for main and ever…
nickvigilante Oct 28, 2026
de909b0
feat(api-reference): filter the schemas page and group it by package
nickvigilante Oct 28, 2026
60aac3d
fix(api-reference): keep the code-sample tabs clickable after a tall …
nickvigilante Oct 28, 2026
e9b2c56
feat(api-reference): widen the example column to half the content width
nickvigilante Oct 28, 2026
54a0d15
feat(api-reference): format the code samples to fit the example column
nickvigilante Oct 28, 2026
fc73bb6
style(api-reference): format the operation-page test
nickvigilante Oct 28, 2026
2f26d05
feat(api-reference): write each code sample as its language's formatt…
nickvigilante Oct 28, 2026
269b72c
test(url-parity): approve main's API reference anchor deltas
nickvigilante Oct 28, 2026
4ad4c91
fix(api-reference): trim a basePath's trailing slashes without a regex
nickvigilante Oct 28, 2026
9cad663
fix(ci): check out coderd/apidoc where the publish and historical syn…
nickvigilante Oct 28, 2026
61042cc
fix(openapi): fail a publish that has no Swagger document for a versi…
nickvigilante Oct 28, 2026
d769473
fix(offlinedocs): read the API reference data whatever DOCS_VERSION n…
nickvigilante Oct 28, 2026
ba6389c
fix(openapi): let DOCS_OPENAPI reach the sync under turbo and fail on…
nickvigilante Oct 28, 2026
4658d84
fix(docs-sources): tell a missing Swagger document apart from a faile…
nickvigilante Oct 28, 2026
baacb1e
fix(docs-next): keep the old-anchor redirect from crashing on #% or f…
nickvigilante Oct 28, 2026
f833e9d
fix(docs-build): cap the card description's input before the quadrati…
nickvigilante Oct 28, 2026
844a822
fix(docs-build): fail when two generated API reference pages would sh…
nickvigilante Oct 28, 2026
b49ede5
fix(docs-build): define the CoderProvisionerKey scheme instead of dro…
nickvigilante Oct 28, 2026
64d4804
fix(docs-build): fence an operation's path so a backtick can't end it…
nickvigilante Oct 28, 2026
d46b8c8
test(openapi): show the renderer and post-conversion $ref checks reje…
nickvigilante Oct 28, 2026
d07fa46
test(docs-next): pin what pruneDocument keeps of the API document
nickvigilante Oct 28, 2026
4de374c
test(docs-next): exempt only a URL line whose path is too long from t…
nickvigilante Oct 28, 2026
0480281
fix(docs-next): keep a multipart field name from turning the curl sam…
nickvigilante Oct 28, 2026
9159efc
build(docs-next): move the API page's shiki to 4.5.0 so the site has …
nickvigilante Oct 28, 2026
e1e54c8
fix(docs-next): name the API page's response and example selects, and…
nickvigilante Oct 28, 2026
bcdf21b
docs: record how the REST API reference is built in ARCHITECTURE.md
nickvigilante Oct 28, 2026
70ba22b
fix(docs-theme): give the schema groups a chevron that turns when the…
nickvigilante Oct 28, 2026
b01fdfb
refactor(docs-build): name the converted-document check's parameter spec
nickvigilante Oct 28, 2026
532393f
Merge origin/main into vigilante/docs-1431-openapi-spike
nickvigilante Oct 29, 2026
74a1d9a
feat(docs-next): keep fumadocs-openapi's API playground out of the build
nickvigilante Oct 29, 2026
effac49
ci: fail a build whose export ships API playground code
nickvigilante Oct 29, 2026
41e09d7
test(docs-site): skip the playground stub loader when finding MDX loa…
nickvigilante Oct 29, 2026
a3ace94
refactor(docs-config): hold the REST API reference contract in one mo…
nickvigilante Oct 29, 2026
f2001fb
refactor: recognise the API reference with one predicate
nickvigilante Oct 29, 2026
40d996a
refactor(docs-sources): read the API document from the version's chec…
nickvigilante Oct 29, 2026
2158fea
refactor: name the API reference data file and read it in one place
nickvigilante Oct 29, 2026
12147a5
refactor(docs-next): build a page's served link with one pageHref
nickvigilante Oct 29, 2026
9a5ef06
refactor(docs-manifest): compare lines in isLineAtLeast with compareV…
nickvigilante Oct 29, 2026
1f7e41c
fix(docs-build): take the landing page's heading ids from the heading…
nickvigilante Oct 29, 2026
2f5bf5e
refactor(docs-next): escape single-quoted sample strings in one place
nickvigilante Oct 29, 2026
f182633
test(docs-next): mount client components and type into inputs with sh…
nickvigilante Oct 29, 2026
dff041b
test(docs-next): pin each API page select's name to what the select s…
nickvigilante Oct 29, 2026
df5e106
Merge branch 'main' into vigilante/docs-1431-openapi-spike
nickvigilante Oct 29, 2026
d3a5f7b
Merge branch 'main' into vigilante/docs-1431-openapi-spike
nickvigilante Nov 12, 2026
2cd6852
chore: merge main and regenerate pnpm-lock.yaml
coder[bot] Nov 16, 2026
03ca329
Merge remote-tracking branch 'origin/main' into vigilante/docs-1431-o…
nickvigilante Nov 20, 2026
bec26bb
build(deps): upgrade fumadocs-openapi to 12.6.1 and drop the workarou…
nickvigilante Nov 20, 2026
93b9dd0
merge: bring main into the OpenAPI reference branch
nickvigilante Nov 23, 2026
e75537f
fix(docs-theme): give API example figures the dark code window
nickvigilante Nov 23, 2026
410fc59
fix(docs-config): keep node:path out of the package root
nickvigilante Nov 23, 2026
ae799b0
fix(docs-build): fence schema names as code spans in the schemas table
nickvigilante Nov 24, 2026
328316f
fix(docs-next): leave = field names out of all four API samples
nickvigilante Nov 24, 2026
8d10c2d
fix(docs-next): decode JSON Pointer escapes when pruning an API document
nickvigilante Nov 24, 2026
5eceeac
style(docs-theme): format the brand stylesheet test
nickvigilante Nov 24, 2026
e4479c8
merge: bring main into the OpenAPI reference branch
nickvigilante Nov 24, 2026
1e469ac
fix(docs-theme): use weight 500 for the heading # link
nickvigilante Nov 24, 2026
00a4c21
fix(docs-transforms): refuse over-nested Markdown before headingIds p…
nickvigilante Nov 24, 2026
7912137
fix(docs-build): protect generated API section ids from Next.js boots…
nickvigilante Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ jobs:
run: pnpm --filter @coder/docs-site csp:check
- name: No zod in first-load JavaScript (apps/docs)
run: pnpm --filter @coder/docs-site first-load:check
- name: No API playground code (apps/offlinedocs)
run: pnpm --filter @coder/offlinedocs playground:check
- name: No API playground code (apps/docs)
run: pnpm --filter @coder/docs-site playground:check
- name: URL and anchor parity (apps/docs)
run: pnpm --filter @coder/docs-site parity:urls

Expand Down Expand Up @@ -205,6 +209,46 @@ jobs:
shellcheck --version
actionlint -color

# Every API code sample must already be what its language's formatter writes.
code-samples-format:
name: code samples format
runs-on: ubuntu-latest
timeout-minutes: 15
env:
RUFF_VERSION: 0.17.2
SHFMT_VERSION: 3.14.1
SHFMT_SHA256: 76e77641faa025814b77f153b29796b8e6fa2fca03e0c76a691608b86c7ea7bf
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: ./.github/actions/setup
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: 1.25.x
cache: false
- name: Install ruff
run: pipx install "ruff==${RUFF_VERSION}"
- name: Install shfmt
run: |
set -euo pipefail
binary="shfmt_v${SHFMT_VERSION}_linux_amd64"
mkdir -p "$RUNNER_TEMP/shfmt-bin"
cd "$RUNNER_TEMP/shfmt-bin"
curl -fsSL -o "$binary" "https://github.com/mvdan/sh/releases/download/v${SHFMT_VERSION}/$binary"
echo "$SHFMT_SHA256 $binary" | sha256sum -c -
mv "$binary" shfmt
chmod +x shfmt
echo "$RUNNER_TEMP/shfmt-bin" >> "$GITHUB_PATH"
- name: Build the packages
run: pnpm turbo run build --filter='./packages/*'
- name: Check the samples
run: |
set -euo pipefail
go version
ruff --version
shfmt --version
shellcheck --version
pnpm --filter @coder/docs-site samples:format

# The CLI smoke-builds the kit from the packed files alone before packing it.
dist-dry-run:
name: public release dry run
Expand Down Expand Up @@ -311,6 +355,7 @@ jobs:
test-matrix-guard,
actionlint,
dist-dry-run,
code-samples-format,
code-server-pin,
]
runs-on: ubuntu-latest
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/docs-pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ jobs:
repository: ${{ inputs.content_repository }}
ref: ${{ inputs.content_ref }}
path: content
sparse-checkout: docs
# coderd/apidoc holds the Swagger document the API reference is built from.
sparse-checkout: |
docs
coderd/apidoc
Comment on lines +191 to +194

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 The preview gets coderd/apidoc here, but publish-version.yml:379 still checks out only docs, and historical-sync.yml:89 runs sparse-checkout set docs. In single-version mode apps/docs/scripts/sync-docs.mjs calls swaggerFromTree(DOCS_ROOT), which looks for content/coderd/apidoc/swagger.json, finds nothing, and withOpenApiReference logs a warning and keeps the Markdown reference. So the preview shows the new reference, but republishing main and 2.24 to 2.38 as the Merge order section describes ships the old one with every step green. "The publish workflow is untouched" in the PR body is the cause. Add coderd/apidoc to both workflows' sparse checkouts (that touches a production publish job, so it's worth a deliberate look), and see the comment on openapi-output.ts:40 for making the miss fail instead of warn.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9cad663: publish-version.yml and historical-sync.yml now both add coderd/apidoc to their sparse checkouts, the same two paths the preview uses, and nothing else in either job changes. The PR body's claim that the publish workflow is untouched will be corrected too, and 61042cc makes the miss fail a publish rather than warn.

sparse-checkout-cone-mode: true
persist-credentials: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/historical-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
run: |
set -euo pipefail
git clone --quiet --depth 1 --branch "$TAG" --filter=blob:none --sparse https://github.com/coder/coder.git "$RUNNER_TEMP/coder"
git -C "$RUNNER_TEMP/coder" sparse-checkout set docs
git -C "$RUNNER_TEMP/coder" sparse-checkout set docs coderd/apidoc
- name: Sync it with the default historical pipeline
env:
TAG: ${{ steps.ref.outputs.tag }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,10 @@ jobs:
repository: ${{ env.CONTENT_REPOSITORY }}
ref: ${{ steps.resolve.outputs.sha }}
path: content
sparse-checkout: docs
# coderd/apidoc holds the Swagger document the API reference is built from.
sparse-checkout: |
docs
coderd/apidoc
sparse-checkout-cone-mode: true
# Full history, without blobs: the sitemap dates pages from git log.
fetch-depth: 0
Expand Down
26 changes: 24 additions & 2 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ docs-ui ────► docs-config docs-theme (no dependencies)
- `@coder/docs-config` is the root contract package and depends on no other workspace package.
- `@coder/docs-sources` depends on `docs-config`.
- `@coder/docs-transforms` depends on `docs-config` (for the `Manifest` and `DocSource` contracts its pure transforms consume, and the `StaticDocsRenderContext` a static compile resolves the `premium` condition against).
- `@coder/docs-build` depends on `docs-config` and `docs-transforms`.
- `@coder/docs-next` depends on `docs-config`, `docs-ui`, and the dependency-free `version-segment` subpath of `docs-manifest`.
- `@coder/docs-build` depends on `docs-config`, `docs-transforms`, and the `version-segment` subpath of `docs-manifest` (for `isLineAtLeast`, which picks the versions that render the generated REST API reference); its external base for that reference is `swagger2openapi` and `oas-validator`.
- `@coder/docs-next` depends on `docs-config`, `docs-ui`, and the dependency-free `version-segment` subpath of `docs-manifest`; its `openapi` subpath renders the REST API reference with `fumadocs-openapi`.
- `@coder/docs-ui` depends on the zod-free `client` subpath of `docs-config` for the `DocsRenderContext` its runtime `Premium`/`Experimental` annotation components read (loading the zod parser only when a fetched context arrives), and on the `version-segment` subpath of `docs-manifest` for the runtime version switcher's links; its external base is `fumadocs-ui`.
- `@coder/docs-theme` depends on nothing; it ships plain CSS.
- `@coder/docs-manifest` depends on `docs-config` only.
Expand Down Expand Up @@ -133,6 +133,7 @@ Keeping every subword piece and the first 5,000 or more vocabulary rows as well
One version of the docs flows through four stages:

1. **Provider.** A `VersionsProvider` from `@coder/docs-sources` loads the version into a `DocSource`: raw `.md` files, the `manifest.json` sidebar model, resolved images, and optional redirects.
For a version that renders the generated REST API reference, the sync scripts then rewrite that `DocSource` before syncing it (refer to "The REST API reference" below).
2. **Sync.** `syncDocSource` (`@coder/docs-build`) validates the source (dead links, broken images, route collisions, stale manifest entries) and writes a Fumadocs content tree: `.md` files with injected frontmatter, rewritten links and image paths, per-directory `meta.json`, and copied images.
Only pages named by the manifest are emitted.
3. **Compile.** `fumadocs-mdx` compiles the synced tree using `createCoderMdxOptions({ renderContext, linkPrefix })` (`@coder/docs-transforms/mdx-config`), of which `coderMdxOptions` is the default instance (no static context, no link prefix — the in-product runtime pipeline): the Coder remark stack (GitHub callouts, Coder tabs, `<details>` accordions, steps), then `rehype-raw` to reparse the corpus's raw HTML, then the sanitizer, then Shiki highlighting with a fallback language for unbundled fences.
Expand All @@ -144,6 +145,27 @@ This design rests on a `.md`-only precondition: the sync emits only `.md` files,
Emitting `.mdx` would let corpus content execute at compile time and bypass the sanitizer entirely.
Refer to "Security: the corpus is untrusted" in the `@coder/docs-transforms` README for the full invariant.

### The REST API reference

From 2.24 on, and on `main`, the REST API reference is built from coder/coder's Swagger 2.0 document rather than from the Markdown pages its generator writes.
`rendersOpenApi` (`@coder/docs-build`) picks those versions; `OPENAPI_MIN_LINE` is the oldest line, since older documents repeat operation ids.
`DOCS_OPENAPI` set to `0`, `false`, `off` or `no` keeps the Markdown reference for every version, and is the rollback; any value that is not an off or on spelling fails the sync.

The Swagger document is read from the checkout the docs come from, never fetched.
Both `@coder/docs-sources` providers, given `apiDocument: SWAGGER_PATH`, read `coderd/apidoc/swagger.json` onto the version's `DocSource` as `apiDocument`.
The local tree provider reads it beside the `docs/` tree, so every checkout a sync runs on, the publisher's and the preview's sparse ones included, has to hold `coderd/apidoc` as well as `docs`; the git provider reads it from the worktree it loads the version's docs from, so both come from one commit resolution.
A version with no Swagger document keeps its Markdown reference with a warning, except when `DOCS_PUBLISH=1`, where the sync fails, so a publish never ships the old reference for a version that should have the new one.

`withOpenApiReference` rewrites the version's `DocSource` before `syncDocSource` sees it: `applyOpenApiReference` converts the document to OpenAPI 3, adds one Markdown stub page per operation under its tag, turns each tag page and the schemas page into lists of links, and adds the setup section to the landing page.
Each stub carries `_openapi: { method }` in its frontmatter; the sync validates that shape and keeps it, and fumadocs-openapi's loader plugin reads it to draw the sidebar's method badge.
It also writes the version's reference data, the converted document plus the route of every operation page, the old anchors, the landing cards and the schema rows, to `.generated/openapi/<version id>.json` (`docs.json` in the single-version offline export), which the app reads at render time so the document stays out of the server bundle.
A generated page whose path or route another page already has fails the sync.

The page route factories take a `renderBody` hook, which may replace a page's compiled Markdown body, add after it, widen it, or extend its table of contents.
`createOpenApiRenderBody` (`@coder/docs-next/openapi`) is that hook for the reference: an operation page renders through fumadocs-openapi from the document pruned to that operation and what it reaches, with code samples built on the server; the tag and schemas pages add a client redirect from the old single-page anchors; the landing page adds its cards.
fumadocs-openapi's API playground never ships: `withoutOpenApiPlayground` (`@coder/docs-next/next-config`) wraps the Next config of `apps/docs` and `apps/offlinedocs` and replaces the playground, its OAuth flows and fetcher, and the server proxy with inert stubs in every bundle, and `playground:check` fails a build whose JavaScript still holds that code.
Every `$ref` must be in-document (`#/...`) at three points, the Swagger document, the converted document, and the renderer's input, because fumadocs-openapi's bundler fetches or reads any other reference.

## Design decisions

These seams are decided and recorded, but not all are implemented yet.
Expand Down
9 changes: 9 additions & 0 deletions apps/dist-release/src/smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ export async function smokeTestKit({ kitDir, assetsDir, version }) {
if (!new JSDOM(html).window.document.title.trim()) {
throw new Error("the kit's out/index.html has an empty <title>");
}
// Imported here, once the packages it reads are built.
const { findPlaygroundCode } =
await import("../../offlinedocs/scripts/playground-check-helpers.mjs");
const playground = await findPlaygroundCode(path.join(built, "out"));
if (playground.length > 0) {
throw new Error(
`the kit's export ships API playground code: ${playground.map((hit) => hit.file).join(", ")}`,
);
}

await checkFinalizedLockfile(kitDir, path.join(work, "finalized"));
} finally {
Expand Down
3 changes: 3 additions & 0 deletions apps/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ This is the mode the public site is built in: the per-version publisher uses it
| `DOCS_SITE_URL` | `https://coder.com/docs` | Optional; the public origin plus base path, for `og:url` and the canonical link. |
| `DOCS_HOME_URL` | `https://coder.com/` | Optional; the main site the sidebar footer links back to. |
| `DOCS_ANALYTICS` | `1` | Optional; loads coder.com's consent manager and tag manager; see "Analytics". |
| `DOCS_OPENAPI` | `0` | Optional; `0`, `false`, `off` or `no` keeps the Markdown REST API reference. |

A local single-version build, against a real coder/coder clone:

Expand All @@ -175,6 +176,8 @@ Every task the publisher's `pnpm turbo run build --filter=@coder/docs-site` touc
The build task declares the two social-card variables for the same reason: stripped, they take the preview image off every published page with nothing failing.
`DOCS_HOME_URL` is declared there too; stripped, the published pages would lose their link back to the main site the same silent way.
`DOCS_ANALYTICS` is declared for the same reason.
`DOCS_OPENAPI`, the switch that rolls the REST API reference back to Markdown, is declared on `sync`, the only task that reads it; stripped, the rollback would do nothing.
Any value other than the off and on spellings (`1`, `true`, `on`, `yes` or empty) fails the sync, so a mistyped rollback never ships the new reference silently.

### The corpus guard

Expand Down
2 changes: 2 additions & 0 deletions apps/docs/app/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
withSeoMetadata,
} from "@coder/docs-next";
import type { Metadata } from "next";
import { renderApiReference } from "@/lib/openapi";
import { productMetadata } from "@/lib/products";
import { sourceFor } from "@/lib/sources";
import { versions } from "@/lib/versions";
Expand Down Expand Up @@ -39,6 +40,7 @@ const {
// Root-relative image URLs get the same base path Next applies to routes.
assetBasePath: basePath,
openGraph,
renderBody: renderApiReference,
});

// Every version serves the same page at the same slug, so the canonical is the
Expand Down
2 changes: 2 additions & 0 deletions apps/docs/app/global.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import "tailwindcss";
@import "fumadocs-ui/css/neutral.css";
@import "fumadocs-ui/css/preset.css";
@import "fumadocs-openapi/css/preset.css";
@import "@coder/docs-theme";

@import "@fontsource-variable/geist";
Expand All @@ -16,6 +17,7 @@
* pre-generated CSS only for its own layouts). */
@source "../node_modules/@coder/docs-ui/dist/*.js";
@source "../node_modules/@coder/docs-next/dist/*.js";
@source "../node_modules/@coder/docs-next/dist/openapi/*.js";
@source "../node_modules/fumadocs-ui/dist/components/ui/popover.js";

/* coder.com's consent manager, present only when DOCS_ANALYTICS is on. The
Expand Down
9 changes: 9 additions & 0 deletions apps/docs/fixtures/docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
"state": ["early access", "beta"]
}
]
},
{
"title": "REST API",
"path": "./reference/api/index.md",
"children": [
{ "title": "Users", "path": "./reference/api/users.md" },
{ "title": "Workspaces", "path": "./reference/api/workspaces.md" },
{ "title": "Schemas", "path": "./reference/api/schemas.md" }
]
}
]
}
16 changes: 16 additions & 0 deletions apps/docs/fixtures/docs/reference/api/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: REST API
description: "Reference for the Coder REST API, including endpoints, authentication, and schemas."
---

Get started with the Coder API.

## Quickstart

List your workspaces:

```sh
coder tokens create
```

Send the token in the `Coder-Session-Token` header of each request.
16 changes: 16 additions & 0 deletions apps/docs/fixtures/docs/reference/api/schemas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Schemas
---

## codersdk.User

| Name | Type | Required | Restrictions | Description |
|------------|--------|----------|--------------|-------------|
| `id` | string | false | | |
| `username` | string | false | | |

## codersdk.WorkspacesResponse

| Name | Type | Required | Restrictions | Description |
|---------|---------|----------|--------------|-------------|
| `count` | integer | false | | |
23 changes: 23 additions & 0 deletions apps/docs/fixtures/docs/reference/api/users.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Users
---

## Create new user

`POST /api/v2/users`

### Responses

| Status | Meaning | Description | Schema |
|--------|--------------------------------------------------------------|-------------|------------------------------------------|
| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.User](schemas.md#codersdkuser) |

## Get user by name

`GET /api/v2/users/{user}`

### Responses

| Status | Meaning | Description | Schema |
|--------|---------------------------------------------------------|-------------|------------------------------------------|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.User](schemas.md#codersdkuser) |
15 changes: 15 additions & 0 deletions apps/docs/fixtures/docs/reference/api/workspaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Workspaces
---

## List workspaces

`GET /api/v2/workspaces`

Returns the workspaces the caller can read, filtered by the search query.

### Responses

| Status | Meaning | Description | Schema |
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------|
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.WorkspacesResponse](schemas.md#codersdkworkspacesresponse) |
Loading
Loading