Repository navigation
feat(api-reference): render the REST API reference with fumadocs-openapi #273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 c4bfa81
fix(api-reference): reject external $refs and read swagger.json like …
nickvigilante c2f01d2
fix(api-reference): pass the axe pass on the API pages
nickvigilante 6168236
fix(docs-theme): recolour API links under More contrast without touch…
nickvigilante edf5a68
fix(api-reference): escape backslashes and Markdown syntax in operati…
nickvigilante 9ffecca
feat(api-reference): show a copyable curl command instead of the play…
nickvigilante c8ef253
feat(api-reference): bring back the playground beside the curl sample
nickvigilante d3fcc4b
fix(ci): omit empty pr_number meta from preview deploys
nickvigilante e4b8377
feat(api-reference): show code samples in curl, JavaScript, Python an…
nickvigilante 00d053c
feat(api-reference): show each operation's method badge in the sidebar
nickvigilante b3f81c3
feat(api-reference): set-up section and operation cards on the API la…
nickvigilante 613dbf3
fix(api-reference): name the playground's language select and recolou…
nickvigilante faa80fc
feat(api-reference): hide the API playground for now
nickvigilante f80851d
Merge remote-tracking branch 'origin/main' into vigilante/docs-1431-o…
nickvigilante 6f04ff7
fix(api-reference): stop a bad stored server URL from crashing operat…
nickvigilante b928dd2
fix(api-reference): keep curl's @file argument out of the version-seg…
nickvigilante 297dbdb
fix(api-reference): trim the landing page's end without a backtrackin…
nickvigilante 52aced8
refactor(api-reference): move the sync's Swagger reading and referenc…
nickvigilante 3ee6ec3
fix(api-reference): fold an older Swagger document's basePath into it…
nickvigilante 9273ff9
feat(api-reference): render the generated reference for main and ever…
nickvigilante de909b0
feat(api-reference): filter the schemas page and group it by package
nickvigilante 60aac3d
fix(api-reference): keep the code-sample tabs clickable after a tall …
nickvigilante e9b2c56
feat(api-reference): widen the example column to half the content width
nickvigilante 54a0d15
feat(api-reference): format the code samples to fit the example column
nickvigilante fc73bb6
style(api-reference): format the operation-page test
nickvigilante 2f26d05
feat(api-reference): write each code sample as its language's formatt…
nickvigilante 269b72c
test(url-parity): approve main's API reference anchor deltas
nickvigilante 4ad4c91
fix(api-reference): trim a basePath's trailing slashes without a regex
nickvigilante 9cad663
fix(ci): check out coderd/apidoc where the publish and historical syn…
nickvigilante 61042cc
fix(openapi): fail a publish that has no Swagger document for a versi…
nickvigilante d769473
fix(offlinedocs): read the API reference data whatever DOCS_VERSION n…
nickvigilante ba6389c
fix(openapi): let DOCS_OPENAPI reach the sync under turbo and fail on…
nickvigilante 4658d84
fix(docs-sources): tell a missing Swagger document apart from a faile…
nickvigilante baacb1e
fix(docs-next): keep the old-anchor redirect from crashing on #% or f…
nickvigilante f833e9d
fix(docs-build): cap the card description's input before the quadrati…
nickvigilante 844a822
fix(docs-build): fail when two generated API reference pages would sh…
nickvigilante b49ede5
fix(docs-build): define the CoderProvisionerKey scheme instead of dro…
nickvigilante 64d4804
fix(docs-build): fence an operation's path so a backtick can't end it…
nickvigilante d46b8c8
test(openapi): show the renderer and post-conversion $ref checks reje…
nickvigilante d07fa46
test(docs-next): pin what pruneDocument keeps of the API document
nickvigilante 4de374c
test(docs-next): exempt only a URL line whose path is too long from t…
nickvigilante 0480281
fix(docs-next): keep a multipart field name from turning the curl sam…
nickvigilante 9159efc
build(docs-next): move the API page's shiki to 4.5.0 so the site has …
nickvigilante e1e54c8
fix(docs-next): name the API page's response and example selects, and…
nickvigilante bcdf21b
docs: record how the REST API reference is built in ARCHITECTURE.md
nickvigilante 70ba22b
fix(docs-theme): give the schema groups a chevron that turns when the…
nickvigilante b01fdfb
refactor(docs-build): name the converted-document check's parameter spec
nickvigilante 532393f
Merge origin/main into vigilante/docs-1431-openapi-spike
nickvigilante 74a1d9a
feat(docs-next): keep fumadocs-openapi's API playground out of the build
nickvigilante effac49
ci: fail a build whose export ships API playground code
nickvigilante 41e09d7
test(docs-site): skip the playground stub loader when finding MDX loa…
nickvigilante a3ace94
refactor(docs-config): hold the REST API reference contract in one mo…
nickvigilante f2001fb
refactor: recognise the API reference with one predicate
nickvigilante 40d996a
refactor(docs-sources): read the API document from the version's chec…
nickvigilante 2158fea
refactor: name the API reference data file and read it in one place
nickvigilante 12147a5
refactor(docs-next): build a page's served link with one pageHref
nickvigilante 9a5ef06
refactor(docs-manifest): compare lines in isLineAtLeast with compareV…
nickvigilante 1f7e41c
fix(docs-build): take the landing page's heading ids from the heading…
nickvigilante 2f5bf5e
refactor(docs-next): escape single-quoted sample strings in one place
nickvigilante f182633
test(docs-next): mount client components and type into inputs with sh…
nickvigilante dff041b
test(docs-next): pin each API page select's name to what the select s…
nickvigilante df5e106
Merge branch 'main' into vigilante/docs-1431-openapi-spike
nickvigilante d3a5f7b
Merge branch 'main' into vigilante/docs-1431-openapi-spike
nickvigilante 2cd6852
chore: merge main and regenerate pnpm-lock.yaml
coder[bot] 03ca329
Merge remote-tracking branch 'origin/main' into vigilante/docs-1431-o…
nickvigilante bec26bb
build(deps): upgrade fumadocs-openapi to 12.6.1 and drop the workarou…
nickvigilante 93b9dd0
merge: bring main into the OpenAPI reference branch
nickvigilante e75537f
fix(docs-theme): give API example figures the dark code window
nickvigilante 410fc59
fix(docs-config): keep node:path out of the package root
nickvigilante ae799b0
fix(docs-build): fence schema names as code spans in the schemas table
nickvigilante 328316f
fix(docs-next): leave = field names out of all four API samples
nickvigilante 8d10c2d
fix(docs-next): decode JSON Pointer escapes when pruning an API document
nickvigilante 5eceeac
style(docs-theme): format the brand stylesheet test
nickvigilante e4479c8
merge: bring main into the OpenAPI reference branch
nickvigilante 1e469ac
fix(docs-theme): use weight 500 for the heading # link
nickvigilante 00a4c21
fix(docs-transforms): refuse over-nested Markdown before headingIds p…
nickvigilante 7912137
fix(docs-build): protect generated API section ids from Next.js boots…
nickvigilante File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
| 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. |
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
| 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 | | | |
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
| 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) | |
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
| 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) | |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
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/apidochere, butpublish-version.yml:379still checks out onlydocs, andhistorical-sync.yml:89runssparse-checkout set docs. In single-version modeapps/docs/scripts/sync-docs.mjscallsswaggerFromTree(DOCS_ROOT), which looks forcontent/coderd/apidoc/swagger.json, finds nothing, andwithOpenApiReferencelogs a warning and keeps the Markdown reference. So the preview shows the new reference, but republishingmainand 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. Addcoderd/apidocto both workflows' sparse checkouts (that touches a production publish job, so it's worth a deliberate look), and see the comment onopenapi-output.ts:40for making the miss fail instead of warn.There was a problem hiding this comment.
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.