Repository navigation
Conversation
When an operation's description changes, the diff core detects the change (ChangedOperation#description, DiffResult.METADATA), but HtmlRender never emitted it: the operation was listed as changed while the report showed no detail at all. Add a Description section to the operation detail list in HtmlRender, mirroring the existing j2html pattern used for other operation-level changes (Operation ID, Parameters, Request, Response): the old description is struck through and the new one shown next to it, like the changed parameter notes. MarkdownRender had the same gap and now renders the changed description through the existing metadata helper, respecting the showChangedMetadata flag like the summary does. Fixes OpenAPITools#857.
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
MarkdownRenderTest: assert the complete old-to-new metadata sequence emitted by MarkdownRender (blockquote old, 'to:' separator, blockquote new) instead of matching either description substring, which the new description satisfied on its own. HtmlRenderTest (showAllChanges mode): assert the <del class="comment"> element carries the old description and the <span class="comment"> element carries the new one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #857.
When an operation's
descriptionchanges, the diff core detects it (OperationDiffsetsChangedOperation#description,DiffResult.METADATA), and the operation is listed under "What's Changed" - but neitherHtmlRendernorMarkdownRenderemitted the changed description, so the report showed a changed operation with no visible detail.Change
HtmlRender: adds aDescriptionsection to the operation's detail list (ul_detail), following the exact j2html pattern used for the other operation-level sections (Operation ID, Parameters, Request, Response): aliwith anh3heading wrapping aul.change.descriptionitem. The old description is struck through (del,commentclass) and the new one shown next to it ("change into"), mirroring how the changed parameter notes (li_changedParam) are already rendered. Rendered for both the default andshowAllChangesrenderers, since the operation appears in the changed list in both cases.MarkdownRender: had the same gap, fixed symmetrically with the existingmetadata(...)helper, so it respects theshowChangedMetadataflag exactly like the operation summary does:showChangedMetadata:Changed description:old -> newConsole/Asciidoc renderers also do not show operation description changes today; left out of this PR to keep the diff focused on the reported issue (can follow up if wanted).
Repro from the issue
Tested with the two specs attached to the issue (
sample-api_3.47.0_ALL.json/sample-api_3.48.0_ALL.json, only theCANoperation description and the version differ), copied asissue-857-operation-description-1.json/issue-857-operation-description-2.json. Before: the changed operation rendered asPOST /sample-api/{id}/actions/CANwith an empty detail list. After, the HTML report contains:Tests
HtmlRenderTest#issue857_renderShowsChangedOperationDescription(default renderer): asserts the old -> new description snippet (delwith the old text,spanwith the new text) is present.HtmlRenderTest#issue857_renderWithShowAllChangesShowsChangedOperationDescription(theshowAllChanges=trueconstructor used in the issue).MarkdownRenderTest#issue857_renderShowsChangedOperationDescription(withshowChangedMetadata, asserting the old and new description are rendered).mvn -pl core test: 273 tests, 0 failures;com.coveo:fmt-maven-plugin:checkpasses.Note on coordination: open PRs #930 (media type examples) and #933 (security requirements in Markdown) touch the same renderer files, but at different locations - this change only adds the operation-description rendering path and does not overlap their lines.
Summary by cubic
Fixes #857: renders changed operation descriptions in
HtmlRenderandMarkdownRenderreports so a changed operation no longer appears under "What's Changed" with empty detail.The diff core already detected the description change, but neither renderer emitted it.
HtmlRendernow shows a Description section with the old description struck through next to the new one, andMarkdownRenderrenders the change through the existing metadata helper, respecting theshowChangedMetadataflag. Tests assert the full old-to-new rendering in both renderers, covering default andshowAllChangesmodes.Written for commit d007987. Summary will update on new commits.