Add postProcess method to show donation message (#8142)

* add postProcess method to show donation message

* update comment
This commit is contained in:
William Cheng 2020-12-18 10:16:21 +08:00 committed by GitHub
parent f766735d5c
commit 49f55b0d8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View File

@ -182,6 +182,8 @@ public interface CodegenConfig {
Map<String, Object> updateAllModels(Map<String, Object> objs);
void postProcess();
Map<String, Object> postProcessAllModels(Map<String, Object> objs);
Map<String, Object> postProcessModels(Map<String, Object> objs);

View File

@ -747,6 +747,16 @@ public class DefaultCodegen implements CodegenConfig {
ModelUtils.setDisallowAdditionalPropertiesIfNotPresent(getDisallowAdditionalPropertiesIfNotPresent());
}
// override with any message to be shown right before the process finishes
@SuppressWarnings("static-method")
public void postProcess() {
System.out.println("################################################################################");
System.out.println("# Thanks for using OpenAPI Generator. #");
System.out.println("# Please consider donation to help us maintain this project \uD83D\uDE4F #");
System.out.println("# https://opencollective.com/openapi_generator/donate #");
System.out.println("################################################################################");
}
// override with any special post-processing
@SuppressWarnings("static-method")
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {

View File

@ -925,6 +925,9 @@ public class DefaultGenerator implements Generator {
}
}
// post-process
config.postProcess();
// reset GlobalSettings, so that the running thread can be reused for another generator-run
GlobalSettings.reset();