@@ -355,6 +355,22 @@ public void flattenProperties(Map<String, Property> properties, String path) {
355
355
}
356
356
}
357
357
}
358
+ } else if (property instanceof ComposedProperty ) {
359
+ ComposedProperty composedProperty = (ComposedProperty ) property ;
360
+ String modelName = resolveModelName (composedProperty .getTitle (), path + "_" + key );
361
+ Model model = modelFromProperty (composedProperty , modelName );
362
+ String existing = matchGenerated (model );
363
+ if (existing != null ) {
364
+ RefProperty refProperty = new RefProperty (existing );
365
+ refProperty .setRequired (composedProperty .getRequired ());
366
+ propsToUpdate .put (key , refProperty );
367
+ } else {
368
+ RefProperty refProperty = new RefProperty (modelName );
369
+ refProperty .setRequired (composedProperty .getRequired ());
370
+ propsToUpdate .put (key , refProperty );
371
+ addGenerated (modelName , model );
372
+ swagger .addDefinition (modelName , model );
373
+ }
358
374
}
359
375
}
360
376
if (propsToUpdate .size () > 0 ) {
@@ -428,6 +444,30 @@ public Model modelFromProperty(ObjectProperty object, String path) {
428
444
return model ;
429
445
}
430
446
447
+ public Model modelFromProperty (ComposedProperty composedProperty , String path ) {
448
+ String description = composedProperty .getDescription ();
449
+ String example = null ;
450
+
451
+ Object obj = composedProperty .getExample ();
452
+ if (obj != null ) {
453
+ example = obj .toString ();
454
+ }
455
+ Xml xml = composedProperty .getXml ();
456
+
457
+ ModelImpl model = new ModelImpl ();
458
+ model .type (composedProperty .getType ());
459
+ model .setDescription (description );
460
+ model .setExample (example );
461
+ model .setName (path );
462
+ model .setXml (xml );
463
+ if (composedProperty .getVendorExtensions () != null ) {
464
+ for (String key : composedProperty .getVendorExtensions ().keySet ()) {
465
+ model .setVendorExtension (key , composedProperty .getVendorExtensions ().get (key ));
466
+ }
467
+ }
468
+ return model ;
469
+ }
470
+
431
471
@ SuppressWarnings ("static-method" )
432
472
public Model modelFromProperty (MapProperty object , @ SuppressWarnings ("unused" ) String path ) {
433
473
String description = object .getDescription ();
0 commit comments