diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/InlineModelResolver.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/InlineModelResolver.java index 1a811ab437..a15511082b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/InlineModelResolver.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/InlineModelResolver.java @@ -45,8 +45,13 @@ public class InlineModelResolver { if (bp.getSchema() != null) { Model model = bp.getSchema(); if(model instanceof ModelImpl) { + String modelName = uniqueName(bp.getName()); ModelImpl obj = (ModelImpl) model; flattenProperties(obj.getProperties(), pathname); + + bp.setSchema(new RefModel(modelName)); + addGenerated(modelName, model); + swagger.addDefinition(modelName, model); } else if (model instanceof ArrayModel) { ArrayModel am = (ArrayModel) model;