private String addListModel(HashMap<String,SwaggerModel> models,Class<?> model,String modelName){
  SwaggerModel swaggerModel=new SwaggerModel();
  swaggerModel.setId(modelName);
  swaggerModel.setName(modelName);
  SwaggerModelProperty modelProperty=new SwaggerModelProperty();
  modelProperty.setType("List");
  modelProperty.setRequired(true);
  HashMap<String,String> items=new HashMap<>();
  items.put(REFERENCE_TYPE,model.getSimpleName());
  modelProperty.setItems(items);
  HashMap<String,SwaggerModelProperty> modelProperties=new HashMap();
  modelProperties.put("items",modelProperty);
  swaggerModel.setProperties(modelProperties);
  String listModelName=String.format("%s<%s>",modelName,model.getSimpleName());
  models.put(listModelName,swaggerModel);
  return listModelName;
}

private String addListModel ( HashMap < String , SwaggerModel > models , Class < ? > model , String modelName ) { SwaggerModel swaggerModel = new SwaggerModel ( ) ; swaggerModel . setId ( modelName ) ; swaggerModel . setName ( modelName ) ; SwaggerModelProperty modelProperty = new SwaggerModelProperty ( ) ; modelProperty . setType ( "List" ) ; modelProperty . setRequired ( true ) ; HashMap < String , String > items = new HashMap < > ( ) ; items . put ( REFERENCE_TYPE , model . getSimpleName ( ) ) ; modelProperty . setItems ( items ) ; HashMap < String , SwaggerModelProperty > modelProperties = new HashMap ( ) ; modelProperties . put ( "items" , modelProperty ) ; swaggerModel . setProperties ( modelProperties ) ; String listModelName = String . format ( "%s<%s>" , modelName , model . getSimpleName ( ) ) ; models . put ( listModelName , swaggerModel ) ; return listModelName ; }
converts a list class to a swaggermodel api representation and adds it to the models hashmap . list < t > cannot be reflected and it ' s impossible to create class of list < model > at runtime for " type erasure " reason . we are generating a swaggermodel specifically for list with most fields hardcoded .
