Skip to content

Remove sanitizeKdoc — redundant with KotlinPoet 2.3.0#66

Open
halotukozak wants to merge 1 commit into
masterfrom
kdoc-does-not-require-sanitazing
Open

Remove sanitizeKdoc — redundant with KotlinPoet 2.3.0#66
halotukozak wants to merge 1 commit into
masterfrom
kdoc-does-not-require-sanitazing

Conversation

@halotukozak
Copy link
Copy Markdown
Member

Summary

  • KotlinPoet 2.3.0 (#2258) escapes /* and */ in CodeWriter.emitKdoc (replaces with *), identical to local sanitizeKdoc() helper.
  • Removed sanitizeKdoc() extension from NameUtils.kt and all 9 call sites in ClientGenerator.kt / ModelGenerator.kt.
  • No behavioral change in generated output.

Test plan

  • ./gradlew ktlintCheck test passes
  • Verify generated KDoc still escapes comment terminators on a schema containing */ in description

🤖 Generated with Claude Code

CodeWriter in 2.3.0 (#2258) replaces /* and */ with * in kdoc mode,
making the local sanitizeKdoc() helper redundant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 12, 2026 11:15
@github-actions
Copy link
Copy Markdown

Coverage Report

Overall Project 96.62% -0.34% 🍏
Files changed 71.32%

File Coverage
ClientGenerator.kt 100% 🍏
NameUtils.kt 97.87% 🍏
ModelGenerator.kt 95.64% -1.83%

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the local sanitizeKdoc() helper and switches generated KDoc to rely on KotlinPoet 2.3.0’s built-in escaping of comment terminators during KDoc emission.

Changes:

  • Removed the String.sanitizeKdoc() extension from NameUtils.kt.
  • Updated client and model generators to pass endpoint/schema/property descriptions directly into addKdoc(...) (removed 9 call sites).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
core/src/main/kotlin/com/avsystem/justworks/core/gen/NameUtils.kt Removes the sanitizeKdoc() extension helper.
core/src/main/kotlin/com/avsystem/justworks/core/gen/model/ModelGenerator.kt Stops sanitizing schema/property/enum descriptions before adding them as KDoc.
core/src/main/kotlin/com/avsystem/justworks/core/gen/client/ClientGenerator.kt Stops sanitizing endpoint summary/description/param docs before adding them as KDoc.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

kdocParts.add("@param ${param.name.toCamelCase()} ${param.description}")
}
if (kdocParts.isNotEmpty()) {
funBuilder.addKdoc("%L", kdocParts.joinToString("\n"))

if (schema.description != null) {
parentBuilder.addKdoc("%L", schema.description.sanitizeKdoc())
parentBuilder.addKdoc("%L", schema.description)
fun String.sanitizeKdoc(): String = replace("*/", "&#42;/")
.replace("/*", "/&#42;")

/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants