feat(codegen): require a ts example on every trait method#147
Merged
Conversation
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.
2 tasks
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 }.
filvecchiato
approved these changes
May 29, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Codegen now validates that every public TrUAPI trait method carries an extractable
```tsexample 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::generateruns a method-example check that rejects: no example fence, an unrecognized fence label, or a code fence left behind in the generateddescription.```truapi-client-exampleto```tsso all 9 methods render in the playground EXAMPLE tab with clean descriptions.Closes #146
Authored with assistance from Claude Code.