@@ -51,17 +51,46 @@ public class MarkdownRender implements Render {
5151 public void render (ChangedOpenApi diff , OutputStreamWriter outputStreamWriter ) {
5252 this .diff = diff ;
5353 this .handledSchemas .clear ();
54+
55+ apiTitle (
56+ diff .getNewSpecOpenApi ().getInfo ().getTitle (),
57+ diff .getNewSpecOpenApi ().getInfo ().getVersion (),
58+ outputStreamWriter );
5459 listEndpoints ("What's New" , diff .getNewEndpoints (), outputStreamWriter );
5560 listEndpoints ("What's Deleted" , diff .getMissingEndpoints (), outputStreamWriter );
5661 listEndpoints ("What's Deprecated" , diff .getDeprecatedEndpoints (), outputStreamWriter );
5762 listEndpoints (diff .getChangedOperations (), outputStreamWriter );
63+ changeSummary ("Result" , diff , outputStreamWriter );
5864 try {
5965 outputStreamWriter .close ();
6066 } catch (IOException e ) {
6167 throw new RendererException (e );
6268 }
6369 }
6470
71+ protected String bigTitle (String title ) {
72+ return H3 + title + '\n' + HR + '\n' ;
73+ }
74+
75+ protected void apiTitle (String title , String version , OutputStreamWriter outputStreamWriter ) {
76+ safelyAppend (outputStreamWriter , bigTitle (title + " (v " + version + ")" ));
77+ }
78+
79+ protected void changeSummary (
80+ String title , ChangedOpenApi diff , OutputStreamWriter outputStreamWriter ) {
81+ safelyAppend (outputStreamWriter , sectionTitle (title ));
82+
83+ if (diff .isUnchanged ()) {
84+ safelyAppend (outputStreamWriter , "No differences. Specifications are equivalent" );
85+ } else if (diff .isCompatible ()) {
86+ safelyAppend (outputStreamWriter , "API changes are backward compatible" );
87+ } else {
88+ safelyAppend (outputStreamWriter , "API changes broke backward compatibility" );
89+ }
90+
91+ safelyAppend (outputStreamWriter , "\n \n " );
92+ }
93+
6594 protected String sectionTitle (String title ) {
6695 return H4 + title + '\n' + HR + '\n' ;
6796 }
0 commit comments