@@ -141,10 +141,11 @@ public abstract class DefaultCodegenConfig implements CodegenConfig {
141
141
protected String templateVersion ;
142
142
protected String embeddedTemplateDir ;
143
143
protected String commonTemplateDir = "_common" ;
144
- protected Map <String , Object > additionalProperties = new HashMap <String , Object >();
144
+ protected Map <String , Object > additionalProperties = new HashMap <>();
145
145
protected Map <String , Object > vendorExtensions = new HashMap <String , Object >();
146
- protected List <SupportingFile > supportingFiles = new ArrayList <SupportingFile >();
147
- protected List <CliOption > cliOptions = new ArrayList <CliOption >();
146
+ protected List <SupportingFile > supportingFiles = new ArrayList <>();
147
+ protected List <SupportingFile > configFiles = new ArrayList <>();
148
+ protected List <CliOption > cliOptions = new ArrayList <>();
148
149
protected List <CodegenArgument > languageArguments ;
149
150
protected boolean skipOverwrite ;
150
151
protected boolean removeOperationIdPrefix ;
@@ -664,6 +665,10 @@ public List<SupportingFile> supportingFiles() {
664
665
return supportingFiles ;
665
666
}
666
667
668
+ public List <SupportingFile > configFiles () {
669
+ return configFiles ;
670
+ }
671
+
667
672
public String outputFolder () {
668
673
return outputFolder ;
669
674
}
@@ -3807,13 +3812,16 @@ protected String getOptionValue(String optionName) {
3807
3812
return codegenArgumentOptional .get ().getValue ();
3808
3813
}
3809
3814
3815
+ public void writeOptional (String outputFolder , SupportingFile supportingFile ) {
3816
+ writeOptional (outputFolder , supportingFile , false );
3817
+ }
3810
3818
/**
3811
3819
* Only write if the file doesn't exist
3812
3820
*
3813
3821
* @param outputFolder Output folder
3814
3822
* @param supportingFile Supporting file
3815
3823
*/
3816
- public void writeOptional (String outputFolder , SupportingFile supportingFile ) {
3824
+ public void writeOptional (String outputFolder , SupportingFile supportingFile , boolean configFile ) {
3817
3825
String folder = "" ;
3818
3826
3819
3827
if (outputFolder != null && !"" .equals (outputFolder )) {
@@ -3826,8 +3834,9 @@ public void writeOptional(String outputFolder, SupportingFile supportingFile) {
3826
3834
else {
3827
3835
folder = supportingFile .destinationFilename ;
3828
3836
}
3837
+ List <SupportingFile > targetFiles = configFile ? this .configFiles : this .supportingFiles ;
3829
3838
if (!new File (folder ).exists ()) {
3830
- supportingFiles .add (supportingFile );
3839
+ targetFiles .add (supportingFile );
3831
3840
} else {
3832
3841
LOGGER .info ("Skipped overwriting " + supportingFile .destinationFilename + " as the file already exists in " + folder );
3833
3842
}
0 commit comments