Skip to content

Commit 49f55b0

Browse files
authored
Add postProcess method to show donation message (#8142)
* add postProcess method to show donation message * update comment
1 parent f766735 commit 49f55b0

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java

+2
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ public interface CodegenConfig {
182182

183183
Map<String, Object> updateAllModels(Map<String, Object> objs);
184184

185+
void postProcess();
186+
185187
Map<String, Object> postProcessAllModels(Map<String, Object> objs);
186188

187189
Map<String, Object> postProcessModels(Map<String, Object> objs);

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java

+10
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,16 @@ public void setOpenAPI(OpenAPI openAPI) {
747747
ModelUtils.setDisallowAdditionalPropertiesIfNotPresent(getDisallowAdditionalPropertiesIfNotPresent());
748748
}
749749

750+
// override with any message to be shown right before the process finishes
751+
@SuppressWarnings("static-method")
752+
public void postProcess() {
753+
System.out.println("################################################################################");
754+
System.out.println("# Thanks for using OpenAPI Generator. #");
755+
System.out.println("# Please consider donation to help us maintain this project \uD83D\uDE4F #");
756+
System.out.println("# https://opencollective.com/openapi_generator/donate #");
757+
System.out.println("################################################################################");
758+
}
759+
750760
// override with any special post-processing
751761
@SuppressWarnings("static-method")
752762
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {

modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java

+3
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,9 @@ public List<File> generate() {
925925
}
926926
}
927927

928+
// post-process
929+
config.postProcess();
930+
928931
// reset GlobalSettings, so that the running thread can be reused for another generator-run
929932
GlobalSettings.reset();
930933

0 commit comments

Comments
 (0)