Skip to content

feat: generate v1 API client from OpenAPI - #62

Draft
EastSun5566 wants to merge 33 commits into
developfrom
feature/dev-3165
Draft

EastSun5566 wants to merge 33 commits into
developfrom
feature/dev-3165

Conversation

@EastSun5566

@EastSun5566 EastSun5566 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What

  • Generate @hackmd/api/raw from the v1 OpenAPI spec with @hey-api/openapi-ts. The existing API class remains the only handwritten convenience layer and delegates to generated operations; users do not need to switch clients.
  • Cover all 59 v1 operations and fix retry isolation.
  • Generate and export an operation registry from the same spec, so the CLI can discover operations offline and call the raw API.
  • Derive public response types from OpenAPI, correcting handwritten mistakes such as note createdAt and lastChangedAt being typed as string instead of number.
  • Support nullable team owners and description: null to clear personal/team note metadata. Note GET descriptions remain strings.

Documentation

  • TypeDoc builds a static API reference from the public API and @hackmd/api/raw types (pnpm docs:build).
  • The Pages workflow deploys it on pushes to master. Before the first deployment, set Settings → Pages → Build and deployment → Source: GitHub Actions in this repository.

Related work

Checks

  • Generated-code check, typecheck, 113 unit tests, build, and TypeDoc pass.
  • All 12 existing live E2E tests previously passed against production with HACKMD_E2E_MUTATIONS=1. The new nullable-description contract is covered by local tests.

Regeneration

After the updated v1 OpenAPI spec is live at api.hackmd.io, run from nodejs/:

pnpm spec:pull
pnpm codegen
pnpm check:generated

Commit spec/hackmd-openapi.json and src/generated/ together, then rerun CI.

Fixes #61 #60

@EastSun5566 EastSun5566 changed the title feat: generate v1 API client from OpenAPI (DEV-3165) feat: generate v1 API client from OpenAPI Sep 24, 2026
@EastSun5566

Copy link
Copy Markdown
Contributor Author

types gen docs:

Screenshot 2026-09-26 at 1 56 02 AM

@EastSun5566
EastSun5566 added this pull request to stack #64 September 26, 2026 16:54
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.

Generate the Node.js API client from the v1 OpenAPI spec

1 participant