forked from loafle/openapi-generator-original
added debug mode
This commit is contained in:
parent
9d6e6b56c6
commit
d12a565032
@ -32,6 +32,9 @@ public class DefaultGenerator implements Generator {
|
|||||||
if(swagger == null || config == null) {
|
if(swagger == null || config == null) {
|
||||||
throw new RuntimeException("missing swagger input or config!");
|
throw new RuntimeException("missing swagger input or config!");
|
||||||
}
|
}
|
||||||
|
if(System.getProperty("debugSwagger") != null) {
|
||||||
|
Json.prettyPrint(swagger);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
config.processOpts();
|
config.processOpts();
|
||||||
if(swagger.getInfo() != null) {
|
if(swagger.getInfo() != null) {
|
||||||
@ -78,6 +81,7 @@ public class DefaultGenerator implements Generator {
|
|||||||
models.putAll(config.additionalProperties());
|
models.putAll(config.additionalProperties());
|
||||||
|
|
||||||
allModels.add(((List<Object>)models.get("models")).get(0));
|
allModels.add(((List<Object>)models.get("models")).get(0));
|
||||||
|
|
||||||
for(String templateName : config.modelTemplateFiles().keySet()) {
|
for(String templateName : config.modelTemplateFiles().keySet()) {
|
||||||
String suffix = config.modelTemplateFiles().get(templateName);
|
String suffix = config.modelTemplateFiles().get(templateName);
|
||||||
String filename = config.modelFileFolder() + File.separator + config.toModelFilename(name) + suffix;
|
String filename = config.modelFileFolder() + File.separator + config.toModelFilename(name) + suffix;
|
||||||
@ -93,6 +97,11 @@ public class DefaultGenerator implements Generator {
|
|||||||
writeToFile(filename, tmpl.execute(models));
|
writeToFile(filename, tmpl.execute(models));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(System.getProperty("debugModels") != null) {
|
||||||
|
System.out.println("############ Model info ############");
|
||||||
|
Json.prettyPrint(allModels);
|
||||||
|
}
|
||||||
|
|
||||||
// apis
|
// apis
|
||||||
Map<String, List<CodegenOperation>> paths = processPaths(swagger.getPaths());
|
Map<String, List<CodegenOperation>> paths = processPaths(swagger.getPaths());
|
||||||
for(String tag : paths.keySet()) {
|
for(String tag : paths.keySet()) {
|
||||||
@ -124,6 +133,10 @@ public class DefaultGenerator implements Generator {
|
|||||||
writeToFile(filename, tmpl.execute(operation));
|
writeToFile(filename, tmpl.execute(operation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(System.getProperty("debugOperations") != null) {
|
||||||
|
System.out.println("############ Operation info ############");
|
||||||
|
Json.prettyPrint(allOperations);
|
||||||
|
}
|
||||||
|
|
||||||
// supporting files
|
// supporting files
|
||||||
Map<String, Object> bundle = new HashMap<String, Object>();
|
Map<String, Object> bundle = new HashMap<String, Object>();
|
||||||
@ -132,6 +145,9 @@ public class DefaultGenerator implements Generator {
|
|||||||
|
|
||||||
Map<String, Object> apis = new HashMap<String, Object>();
|
Map<String, Object> apis = new HashMap<String, Object>();
|
||||||
apis.put("apis", allOperations);
|
apis.put("apis", allOperations);
|
||||||
|
if(swagger.getBasePath() != null) {
|
||||||
|
bundle.put("basePath", swagger.getBasePath());
|
||||||
|
}
|
||||||
bundle.put("apiInfo", apis);
|
bundle.put("apiInfo", apis);
|
||||||
bundle.put("models", allModels);
|
bundle.put("models", allModels);
|
||||||
bundle.put("apiFolder", config.apiPackage().replaceAll("\\.", "/"));
|
bundle.put("apiFolder", config.apiPackage().replaceAll("\\.", "/"));
|
||||||
@ -145,6 +161,11 @@ public class DefaultGenerator implements Generator {
|
|||||||
m.hasMoreModels = true;
|
m.hasMoreModels = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(System.getProperty("debugSupportingFiles") != null) {
|
||||||
|
System.out.println("############ Supporting file info ############");
|
||||||
|
Json.prettyPrint(bundle);
|
||||||
|
}
|
||||||
|
|
||||||
for(SupportingFile support : config.supportingFiles()) {
|
for(SupportingFile support : config.supportingFiles()) {
|
||||||
String outputFolder = config.outputFolder();
|
String outputFolder = config.outputFolder();
|
||||||
if(support.folder != null && !"".equals(support.folder))
|
if(support.folder != null && !"".equals(support.folder))
|
||||||
|
@ -113,11 +113,8 @@ public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConf
|
|||||||
operation.returnContainer = "Set";
|
operation.returnContainer = "Set";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Json.prettyPrint(operation);
|
|
||||||
// if(return)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Json.prettyPrint(objs);
|
|
||||||
return objs;
|
return objs;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user