Repository navigation
docs(api): type-check the endpoint examples against typed fixtures - #199
Merged
truthixify merged 3 commits intoOct 17, 2026
Merged
truthixify merged 3 commits into
truthixify merged 3 commits into
Conversation
Every TypeScript fence in api-reference/endpoints.mdx now compiles as one strict module, in page order, through scripts/check-api-examples.ts (chained into check:snippets, so CI runs it). The shape fences become named interfaces, and the page gains authentication, request, chat, pagination and error-handling examples. The examples run offline against typed response fixtures in scripts/fixtures/api-endpoint-responses.json, compiled with `satisfies <type>`. No no-check fences remain on the page. Closes wraith-protocol#191
|
@aratass Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
truthixify
approved these changes
Oct 17, 2026
truthixify
left a comment
Contributor
There was a problem hiding this comment.
The API example checker compiles 21 strict TypeScript fences and validates all typed fixtures. Approved.
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.
Closes #191.
Summary
check-snippets.tsrenders every fence with// @ts-nocheck, so the endpoint examples were only syntax-checked, and five of them were skipped withno-check. The shape fences withoutno-checkonly passed because TypeScript parsed{ id: string; ... }as a block of labelled statements.Page. Every TypeScript fence in
api-reference/endpoints.mdxis now real TypeScript. Request and response shapes are named interfaces (CreateAgentRequest,AgentInfo,ChatResponse,Message,NotificationList,ApiError, ...), and the error samples are typedApiErrorvalues. Nono-checkfence is left on the page.Examples. New copy-paste examples for authentication (a
fetchclient that sendsAuthorization: Bearerand the optional BYOM headers), requests (create agent with a Stellar-signed ownership message, chat withconversationId), pagination and error handling (WraithApiErrorwithstatusCode, a 404 name lookup). They build on each other in page order. The list endpoints take no page or cursor parameters (none are documented, the SDK client sends none, and the spectre controllers return full arrays), so the pagination example pages on the client instead of inventing query parameters.Gate.
scripts/check-api-examples.ts, chained intocheck:snippetsso the existing CI job runs it:strict: trueagainst the installed SDK, Stellar SDK and Node types. No@ts-nocheck, noanyprelude.scripts/fixtures/api-endpoint-responses.jsonwithsatisfies <type>against the interface the page declares for that response.fetchstub that serves those fixtures. Each request must hit a route documented on the page, send the bearer header, and consume the next fixture for its method and path. Every fixture must be used.Failures point back to the MDX line or the fixture entry.
docs/CONTRIBUTING.mddocuments the check.Verification
pnpm check:snippets(TS fences skipped withno-checkdrop from 14 to 9),check:api-examples,check:snippets-extended,check:placeholders,check:nav-coverage,check:contract-registry,check:compatibility-matrix,check:redirects-and-anchors,test:redirects-and-anchorsandnode localization-qa.cjsall pass.agent.chains), a fixture missingmetaAddressor carrying an extra field, a role outside theMessageunion, an undocumented path, a droppedAuthorizationheader, an unused fixture, and ano-checkfence on the page.Note
The wire
AgentInfoon this page (chain,address,metaAddress) matches what the spectre controllers return. The SDK's exportedAgentInfotype useschains,addressesandmetaAddresses. This PR keeps the documented wire shape and does not touch the SDK.