@@ -214,16 +214,72 @@ private ContainerTag li_missingRequest(String name, MediaType request) {
214
214
}
215
215
216
216
private ContainerTag li_changedRequest (String name , ChangedMediaType request ) {
217
- return li ().withText (String .format ("Changed body: '%s'" , name ))
218
- .with (div_changedSchema (request .getSchema ()));
217
+ ContainerTag li =
218
+ li ().with (div_changedSchema (request .getSchema ()))
219
+ .withText (String .format ("Changed body: '%s'" , name ));
220
+ if (request .isIncompatible ()) {
221
+ li = incompatibility (li , request , "" );
222
+ }
223
+ return li ;
219
224
}
220
225
221
226
private ContainerTag div_changedSchema (ChangedSchema schema ) {
222
227
ContainerTag div = div ();
223
- div .with (h3 ("Schema" ));
228
+ div .with (h3 ("Schema" + ( schema . isIncompatible () ? " incompatible" : "" ) ));
224
229
return div ;
225
230
}
226
231
232
+ private ContainerTag incompatibility (
233
+ final ContainerTag output , final ComposedChanged changed , final String propPrefix ) {
234
+ if (changed .isCoreChanged () == DiffResult .INCOMPATIBLE ) {
235
+ if (changed instanceof ChangedSchema ) {
236
+ ChangedSchema cs = (ChangedSchema ) changed ;
237
+
238
+ cs .getMissingProperties ().keySet ().stream ()
239
+ .forEach (
240
+ (propName ) -> {
241
+ output .with (
242
+ p (String .format (
243
+ "Missing property: %s%s%s" ,
244
+ propPrefix , propPrefix .isEmpty () ? "" : "." , propName ))
245
+ .withClass ("missing" ));
246
+ });
247
+
248
+ if (cs .isChangedType ()) {
249
+ output .with (p ("Changed property type: " + propPrefix ).withClass ("missing" ));
250
+ }
251
+ }
252
+ }
253
+
254
+ if (changed instanceof ChangedSchema ) {
255
+ ChangedSchema cs = (ChangedSchema ) changed ;
256
+
257
+ String description = null ;
258
+ if (!cs .getChangedProperties ().isEmpty ()) {
259
+ cs .getChangedProperties ().entrySet ().stream ()
260
+ .forEach (
261
+ (entry ) -> {
262
+ incompatibility (
263
+ output ,
264
+ entry .getValue (),
265
+ propPrefix + (propPrefix .isEmpty () ? "" : "." ) + entry .getKey ());
266
+ });
267
+ } else if (cs .getItems () != null ) {
268
+ incompatibility (output , cs .getItems (), propPrefix + "[n]" );
269
+ }
270
+
271
+ return output ;
272
+ }
273
+
274
+ for (Changed child : changed .getChangedElements ()) {
275
+ if (child instanceof ComposedChanged ) {
276
+ incompatibility (output , (ComposedChanged ) child , "" );
277
+ }
278
+ }
279
+
280
+ return output ;
281
+ }
282
+
227
283
private ContainerTag ul_param (ChangedParameters changedParameters ) {
228
284
List <Parameter > addParameters = changedParameters .getIncreased ();
229
285
List <Parameter > delParameters = changedParameters .getMissing ();
0 commit comments