Skip to content

fix: escape comment delimiters in generated SDK JSDoc - #1252

Merged
erunion merged 2 commits into
mainfrom
erunion/cx-4045-escape-jsdoc-comment-delimiters
Nov 12, 2026
Merged

erunion merged 2 commits into
mainfrom
erunion/cx-4045-escape-jsdoc-comment-delimiters

Conversation

@erunion

@erunion erunion commented Nov 12, 2026 •

Copy link
Copy Markdown
Member
🚥 Fix CX-4045

🧰 Changes

The TypeScript generator copies OpenAPI info metadata into JSDoc tags on the generated src/index.ts. Title, description, operation summaries, and response descriptions already went through docblockEscape(). Contact name, contact URL, terms of service, license name, and license URL did not. A value containing a comment terminator closed the docblock, and the rest of the value was emitted as TypeScript that runs when the generated SDK is imported.

#addTagToDocblock() now escapes string tag text before adding it, so every tag is covered. Escaping text that was already escaped does not change it.

🧬 QA & Testing

  • npx vitest run packages/api/test/codegen/languages/typescript/index.test.ts
  • A spec with comment delimiters in contact, terms, and license metadata produces one docblock terminator, and importing the generated SDK does not run the trailing text.
  • Ordinary contact, terms, and license values still render as @author, @see, and @license.

OpenAPI info metadata copied into JSDoc tags could close the comment and run as TypeScript when the generated SDK is imported.

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2297c3c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
api Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@erunion erunion added the bug Something isn't working label Nov 12, 2026
Escape comment delimiters to ensure proper JSDoc generation.
@erunion
erunion marked this pull request as ready for review November 12, 2026 22:48
@erunion
erunion merged commit ae45477 into main Nov 12, 2026
8 checks passed
@erunion
erunion deleted the erunion/cx-4045-escape-jsdoc-comment-delimiters branch November 12, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant