added supporting data post processing

This commit is contained in:
Tony Tam 2015-02-14 17:08:51 -08:00
parent dbc4ab51b1
commit feb6119572
3 changed files with 9 additions and 0 deletions

View File

@ -48,4 +48,5 @@ public interface CodegenConfig {
void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations);
Map<String, Object> postProcessModels(Map<String, Object> objs);
Map<String, Object> postProcessOperations(Map<String, Object> objs);
Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs);
}

View File

@ -45,6 +45,11 @@ public class DefaultCodegen {
return objs;
}
// override with any special post-processing
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {
return objs;
}
// override with any special handling of the entire swagger spec
public void processSwagger(Swagger swagger) {}
@ -328,6 +333,7 @@ public class DefaultCodegen {
public CodegenModel fromModel(String name, Model model) {
CodegenModel m = CodegenModelFactory.newInstance(CodegenModelType.MODEL);
System.out.println("created " + m.getClass());
if(reservedWords.contains(name))
m.name = escapeReservedWord(name);
else

View File

@ -164,6 +164,8 @@ public class DefaultGenerator implements Generator {
m.hasMoreModels = true;
}
config.postProcessSupportingFileData(bundle);
if(System.getProperty("debugSupportingFiles") != null) {
System.out.println("############ Supporting file info ############");
Json.prettyPrint(bundle);