Skip to content

docs: DoltHub API v2 reference pages#121

Merged
tbantle22 merged 14 commits into
devfrom
dolthub-api-v2-docs
Jul 6, 2026
Merged

docs: DoltHub API v2 reference pages#121
tbantle22 merged 14 commits into
devfrom
dolthub-api-v2-docs

Conversation

@tbantle22

Copy link
Copy Markdown
Collaborator

Summary

  • Adds generated reference docs for the v2 API at /products/dolthub/api/v2/ alongside the existing v1alpha1 pages
  • One page per OpenAPI tag (user, database, operations) plus a models page and hand-written README + authentication pages
  • Left nav: User / Database / Operations / Models; right nav: individual endpoint summaries as ### headings per page
  • Each endpoint shows: method + path, description, parameters, request body, example curl, responses table with schema links, and a synthesized JSON response example from spec examples

How to update when the spec changes

  1. Copy the new spec: cp path/to/ld/web/packages/dolthub/openapi/v2.yaml specs/dolthub-v2.yaml
  2. Regenerate: npm run generate-api-v2 (from site/dolt/)
  3. Commit the updated generated files

Technical notes

  • scripts/generate-api-v2.mjs reads specs/dolthub-v2.yaml, resolves internal $refs, groups endpoints by tag and sub-resource, and emits one Markdown file per tag
  • Added remark-heading-id so {#operationId} syntax in generated headings produces real HTML id attributes — allows deep-linking from the endpoint index and cross-page schema links
  • Migrated markdown.remarkPlugins / markdown.rehypePlugins in astro.mjs to the unified({...}) integration from @astrojs/markdown-remark (was deprecated in Astro 5+)

Test plan

  • npm run build from site/dolt/ passes clean
  • /products/dolthub/api/v2 renders the overview with the full endpoint index
  • /products/dolthub/api/v2/database right nav shows endpoint summaries (not paths)
  • Schema links in response tables (e.g. Database, Problem) navigate to the correct anchor on the models page
  • {#createDatabase}-style anchors resolve — database#createDatabase deep-links to the right heading

🤖 Generated with Claude Code

tbantle22 and others added 14 commits July 1, 2026 16:19
Adds generated reference docs for the v2 API alongside the existing v1alpha1 pages.

- `specs/dolthub-v2.yaml` — copy of the OpenAPI spec from the dolthub app repo; update this and re-run the generator when the spec changes
- `scripts/generate-api-v2.mjs` — Node.js generator that reads the spec and writes one Markdown page per tag (user, database, operations) plus a models page; run with `npm run generate-api-v2` from `site/dolt/`
- `site/dolt/src/content/products/dolthub/api/v2/` — generated pages (database.md, user.md, operations.md, models.md) plus hand-written README.md and authentication.md
- nav.ts — v2 added as a sibling of v1alpha1 under DoltHub → API
- astro.mjs — migrated remarkPlugins/rehypePlugins from deprecated `markdown.*` config to the `unified({...})` integration from `@astrojs/markdown-remark`; added `remark-heading-id` so `{#anchor}` syntax in generated headings produces real HTML id attributes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This is a yarn workspace; package-lock.json should not be tracked.
Add package-lock.json to .gitignore and commit yarn.lock instead.
Also remove the packageManager field added erroneously to root package.json.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
package-lock.json was removed in favor of yarn.lock; update both
workflows to use yarn for installs and set cache: "yarn".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
yarn hoists packages differently from npm; @types/node was previously
resolved transitively but needs to be explicit since root tsconfig.json
references it in "types".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers URL changes, response envelope, RFC 9457 error model, cursor
pagination, unified async operations, and a full endpoint mapping table.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pulls the latest v2.yaml from origin/main which adds:
- POST /api/v2/databases/{owner}/{database}/forks (createFork)
- GET /api/v2/databases/{owner}/{database}/operations (listOperations)

Regenerates database.md (21 endpoints) and operations.md (2 endpoints),
and fixes the migration guide to use the real paths instead of guesses.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Point new integrations to v2, demote v1alpha1 to "still supported",
and link to the migration guide. Split CSV/Webhooks into their own section.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Revert the yarn migration — restore package-lock.json, drop yarn.lock,
and update CI workflows to use npm install/cache instead of yarn.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The initial lockfile only recorded the darwin-arm64 rollup binary,
hitting the npm/cli#4828 optional-deps bug on Linux CI runners
("Cannot find module @rollup/rollup-linux-x64-gnu"). A clean reinstall
with node_modules removed first produces a lockfile with resolved
entries for every optional platform variant.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
unified({ remarkPlugins, rehypePlugins }) from @astrojs/markdown-remark
returns a MarkdownProcessor, not an Astro integration — it was being
passed into the integrations array where Astro silently ignored it, so
remark-heading-id never ran and headings rendered with the literal
{#customId} syntax still in the text. Astro 6.4+ expects this processor
under markdown.processor instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
npm ci was an unnecessary leftover from the yarn revert — dev's
site.yaml already used plain npm install, so .github should have
no diff against the PR base branch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Move the v1alpha1 and v2 generation instructions out of Caveats into
their own section, and document the v2 generate-api-v2 workflow that
was missing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
README.md's endpoint table is hand-written and wasn't updated when
7c72962 regenerated database.md/operations.md with these two endpoints.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@tbantle22 tbantle22 marked this pull request as ready for review July 6, 2026 18:57
@tbantle22 tbantle22 merged commit b2738b9 into dev Jul 6, 2026
7 checks passed
@tbantle22 tbantle22 deleted the dolthub-api-v2-docs branch July 6, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant