[asciidoc] fix: preserve multi-line descriptions in table cells
IN
7h ago+266+266+012345678901234567890123456789-118-118-012345678901234567890123456789
Fixes #24962.
Multi-line descriptions (paragraphs, bullet lists, …) were collapsed into a single line in the generated AsciiDoc tables, because:
DefaultCodegen.escapeTextreplaces\t,\n,\rwith spaces, so thedescriptionvariable used by the table templates is pre-flattened;- table cells were emitted with the plain
|prefix, which cannot hold multi-line content anyway.
What changed
model.mustache/param.mustache: description cells now use the AsciiDoca|cell prefix and renderunescapedDescriptioninstead ofdescription, so line breaks are preserved and block-level content (lists, paragraphs) can be used inside the cell. Thetablecellcontentlambda still escapes|so cell delimiters remain safe.AsciidocDocumentationCodegen: overridefromRequestBodyto populateunescapedDescriptionfor request body parameters (it was only populated for regular parameters and properties). The change is scoped to this generator only — other generators that renderunescapedDescription(typescript-fetch, typescript-playwright, htmlDocs) are unaffected.- Added a regression test (
testMultilineDescriptionIsPreservedInGeneratedTables) with a new test spec containing multi-line property, parameter and request body descriptions. - Regenerated
samples/documentation/asciidoc(the sample was last generated at7.0.0-SNAPSHOT, so the diff also picks up unrelated pending template drift, e.g. the response table title).
Verification
AsciidocGeneratorTest/AsciidocSampleGeneratorTest: 14 tests, 0 failures (existing pipe-escaping tests unaffected).- Rendered the generated document with Asciidoctor (
asciidoctor/docker-asciidoctor): converts with no warnings; a multi-line description renders as a paragraph followed by a<ul>list inside the table cell — previously it was a single unreadable line as reported in the issue.
PR checklist
- Read the contribution guidelines.
- Regenerated the affected sample via
./bin/generate-samples.sh bin/configs/unmaintained/asciidoc.yaml; no files deleted. - Pull request is created against the
masterbranch.