Skip to content

feat(codegen): require a ts example on every trait method#147

Merged
pgherveou merged 3 commits into
mainfrom
worktree-require-ts-examples
May 29, 2026
Merged

feat(codegen): require a ts example on every trait method#147
pgherveou merged 3 commits into
mainfrom
worktree-require-ts-examples

Conversation

@pgherveou

Copy link
Copy Markdown
Collaborator

Summary

Codegen now validates that every public TrUAPI trait method carries an extractable ```ts example in its doc comment, failing the build (and CI's codegen/playground/explorer jobs) otherwise. This closes the silent gap where a missing or mis-fenced example produced an empty EXAMPLE tab with the snippet dumped into the description, with no failure at build time.

Changes

  • ts::generate runs a method-example check that rejects: no example fence, an unrecognized fence label, or a code fence left behind in the generated description.
  • CoinPayment's examples switch from ```truapi-client-example to ```ts so all 9 methods render in the playground EXAMPLE tab with clean descriptions.

Closes #146


Authored with assistance from Claude Code.

Codegen now fails when a public TrUAPI trait method's doc comment has no
extractable ```ts example, an example fenced with an unrecognized label,
or a code fence left behind in the description. CoinPayment's examples
move from ```truapi-client-example to ```ts so they render in the
playground EXAMPLE tab.
@pgherveou pgherveou requested a review from a team May 29, 2026 08:26
The CoinPayment examples were never typechecked while fenced with the
unrecognized ```truapi-client-example label. Now extracted into the
playground EXAMPLE tab, they use the ambient `truapi` client, drop the
`Client` and nonexistent per-method error-type imports, pass unary
requests directly, and wrap subscription requests in { request }.
@pgherveou pgherveou enabled auto-merge May 29, 2026 09:17
@pgherveou pgherveou merged commit 59202bc into main May 29, 2026
11 checks passed
@pgherveou pgherveou deleted the worktree-require-ts-examples branch May 29, 2026 09:20
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.

Invalid or missing ts example in truapi Rustodoc

2 participants