Show media type example changes in reports

MO
2mo ago
+411-0

An example or examples update can mark an operation as changed while leaving the report with no details when the schema stays the same.

Add example details to the Console, Markdown, Asciidoc and HTML renderers. Added and removed values are shown directly; updates show the old and new values. For named examples, the complete old and new maps are displayed. HTML values are escaped, and Markdown and Asciidoc values use code blocks. When Jackson reports a serialization error, that detail shows a placeholder and the rest of the report continues. A warning is logged without calling the example object's toString(). Example changes keep their existing metadata classification.

The 91 regression cases cover request and response examples, additions, removals, updates, examples alongside schema changes, unchanged examples, markup escaping, throwing getters, self-references, and serialization failures on either side of an update for both singular and named examples. All pass with this change.

Tested on Windows:

  • ./mvnw.cmd -V -B -ntp -ff clean verify on JDK 8, 11 and 21.
  • ./mvnw.cmd -V -B -ntp -ff -Dmaven.compiler.release=8 clean verify on JDK 17.
  • ./mvnw.cmd -B -ntp com.coveo:fmt-maven-plugin:check.
  • Packaged CLI on JDK 8: all four exported reports include the old and new example values, --state returns metadata, and --fail-on-incompatible exits 0.

Fixes #872.


Summary by cubic

Media type example changes now show up in Console, Markdown, Asciidoc, and HTML reports, so an operation isn't marked changed with no visible detail when only an example value differs.

  • Added and removed values render directly; updates show old and new values.
  • Named examples display as complete old and new maps.
  • HTML escapes values; Markdown and Asciidoc put them in code blocks.
  • Examples that can't be serialized render as a placeholder while the rest of the report still renders.
  • Example changes keep their existing metadata classification.
  • Fixes #872.