15
15
import org .slf4j .Logger ;
16
16
import org .slf4j .LoggerFactory ;
17
17
18
+ import java .util .Arrays ;
18
19
import java .util .List ;
19
20
import java .util .Map ;
20
21
@@ -238,6 +239,13 @@ private String schema(int deepness, ComposedSchema schema) {
238
239
.map (schema1 -> refPointer .resolveRef (diff .getNewSpecOpenApi ().getComponents (), schema1 , schema1 .get$ref ()))
239
240
.forEach (composedChild -> sb .append (schema (deepness , composedChild )));
240
241
}
242
+ // if (schema.getOneOf() != null && schema.getOneOf() != null) {
243
+ // LOGGER.debug("One of schema");
244
+ // sb.append(format("%sOne of:\n\n", indent(deepness)));
245
+ // schema.getOneOf().stream()
246
+ // .map(schema1 -> refPointer.resolveRef(diff.getNewSpecOpenApi().getComponents(), schema1, schema1.get$ref()))
247
+ // .forEach(composedChild -> sb.append(schema(deepness + 1, composedChild)));
248
+ // }
241
249
return sb .toString ();
242
250
}
243
251
@@ -247,10 +255,20 @@ private String schema(int deepness, Schema schema) {
247
255
sb .append (properties (deepness , "Property" , schema .getProperties (), true ));
248
256
if (schema instanceof ComposedSchema ) {
249
257
sb .append (schema (deepness , (ComposedSchema ) schema ));
258
+ } else if (schema instanceof ArraySchema ) {
259
+ sb .append (items (deepness , ((ArraySchema ) schema ).getItems ()));
250
260
}
251
261
return sb .toString ();
252
262
}
253
263
264
+ private String items (int deepness , Schema schema ) {
265
+ StringBuilder sb = new StringBuilder ("" );
266
+ sb .append (format ("%sItems (%s)%s\n " , indent (deepness ), type (schema ), Arrays .asList ("object" , "array" ).contains (type (schema )) ? " :\n " : "" ));
267
+ description (indent (deepness + 1 ), schema .getDescription ());
268
+ sb .append (schema (deepness , schema ));
269
+ return sb .toString ();
270
+ }
271
+
254
272
private String properties (final int deepness , String title , Map <String , Schema > properties , boolean showContent ) {
255
273
StringBuilder sb = new StringBuilder ("" );
256
274
if (properties != null ) {
@@ -276,11 +294,11 @@ private String property(int deepness, String name, ChangedSchema schema) {
276
294
}
277
295
278
296
private String property (int deepness , String title , String name , Schema schema ) {
279
- return property (deepness , title , name , schema . getType ( ), schema .getDescription ());
297
+ return property (deepness , title , name , type ( schema ), schema .getDescription ());
280
298
}
281
299
282
300
private String property (int deepness , String title , String name , String type , String description ) {
283
- return format ("%s* %s `%s` (%s)\n %s\n " , indent (deepness ), title , name , type == null ? "object" : type , description (indent (deepness + 1 ), description ));
301
+ return format ("%s* %s `%s` (%s)\n %s\n " , indent (deepness ), title , name , type , description (indent (deepness + 1 ), description ));
284
302
}
285
303
286
304
private String listDiff (int deepness , String name , ListDiff listDiff ) {
0 commit comments