Add cURL examples to API reference markdown exports. - #1532
Conversation
Generated API reference .md files now include executable cURL examples for each endpoint, matching the interactive API reference UI. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Risk HIGH: Adds cURL request examples to API reference markdown exports by extracting a reusable generateCurlRequestExample helper from components/ui/ApiReference/helpers.ts and consuming it in scripts/generateApiMarkdown.ts.
Reasons
components/ui/ApiReference/helpers.tsis a.tsfile insidecomponents/, which triggers the HIGH risk rule for code file modifications outside of content.- The modified helper is a shared/reusable utility — the new
generateCurlRequestExamplefunction is exported and consumed by both the component layer and the build script, so a bug here could affect both the interactive API reference UI and the generated markdown files. - The refactor changes the output format of the existing
augmentSnippetsWithCurlRequestfunction (removes leading whitespace/indentation from the curl template), which could subtly change how cURL snippets render in the interactive API reference. - The author (
scottjstrand1) is not in the repository's known contributor list, so this PR should receive a thorough review. - Two files changed with 60 additions and 14 deletions — a modest diff size, but the structural impact on shared code warrants careful review.
Notes
- Verify that the refactored
augmentSnippetsWithCurlRequestoutput (which no longer has leading indentation) renders identically in the interactive API reference UI. The old template used indented multiline strings; the newgenerateCurlRequestExamplefunction produces flush-left output. - Confirm that
JSON.stringify(body)in the-dflag produces valid shell-safe strings — request bodies containing single quotes would break the generated cURL command. - Check that
stainlessSpec.environments.productionresolves to the correct base URL and doesn't leak internal/staging URLs into the exported markdown. - Review the
requestExamplefallback chain (requestBodyContent?.example || requestBody?.example) to ensure it picks up examples consistently across all endpoints.
Sent by Cursor Automation: Docs PR classifier
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e153a5c. Configure here.
| maybeBodyString, | ||
| ] | ||
| .filter(Boolean) | ||
| .join("\n"); |
There was a problem hiding this comment.
Trailing backslash breaks curl examples
Medium Severity
generateCurlRequestExample always appends a line-continuation \ on the Authorization header, then drops an empty body line via .filter(Boolean). For endpoints without a request body example, the generated command ends with \, so pasted "executable" cURL examples hang in the shell instead of running.
Reviewed by Cursor Bugbot for commit e153a5c. Configure here.




Generated API reference .md files now include executable cURL examples for each endpoint, matching the interactive API reference UI.