Skip to content

Commit

Permalink
fix: escape any comment closing tags in schema descriptions
Browse files Browse the repository at this point in the history
fix #545
  • Loading branch information
josh- authored and Xiphe committed Jan 8, 2024
1 parent 29028bb commit 30a8b78
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/codegen/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -903,11 +903,14 @@ export default class ApiGenerator {
});

if ("description" in schema && schema.description) {
// Escape any JSDoc comment closing tags in description
const description = schema.description.replace("*/", "*\\/");

ts.addSyntheticLeadingComment(
signature,
ts.SyntaxKind.MultiLineCommentTrivia,
// Ensures it is formatted like a JSDoc comment: /** description here */
`* ${schema.description} `,
`* ${description} `,
true,
);
}
Expand Down

0 comments on commit 30a8b78

Please sign in to comment.