@@ -50,10 +50,12 @@ public class GoClientCodegen extends AbstractGoCodegen {
5050 protected String packageVersion = "1.0.0" ;
5151 protected String apiDocPath = "docs/" ;
5252 protected String modelDocPath = "docs/" ;
53+ protected String modelFileFolder = null ;
5354 public static final String WITH_XML = "withXml" ;
5455 public static final String STRUCT_PREFIX = "structPrefix" ;
5556 public static final String WITH_AWSV4_SIGNATURE = "withAWSV4Signature" ;
5657 public static final String GENERATE_INTERFACES = "generateInterfaces" ;
58+ public static final String MODEL_FILE_FOLDER = "modelFileFolder" ;
5759 protected String goImportAlias = "openapiclient" ;
5860 protected boolean isGoSubmodule = false ;
5961 protected boolean useOneOfDiscriminatorLookup = false ; // use oneOf discriminator's mapping for model lookup
@@ -255,6 +257,10 @@ public void processOpts() {
255257 .get (CodegenConstants .DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT ).toString ()));
256258 }
257259
260+ if (additionalProperties .containsKey (MODEL_FILE_FOLDER )) {
261+ modelFileFolder = additionalProperties .get (MODEL_FILE_FOLDER ).toString ();
262+ }
263+
258264 // add lambda for mustache templates to handle oneOf/anyOf naming
259265 // e.g. []string => ArrayOfString
260266 additionalProperties .put ("lambda.type-to-name" , (Mustache .Lambda ) (fragment , writer ) -> writer .write (typeToName (fragment .execute ())));
@@ -301,9 +307,17 @@ public String apiFileFolder() {
301307 return outputFolder + File .separator ;
302308 }
303309
310+ /**
311+ * Location of created model files (it can be overriden using --additional-properties in openapi-generator-cli
312+ */
304313 @ Override
305314 public String modelFileFolder () {
306- return outputFolder + File .separator ;
315+ String modelFileFolderPath = outputFolder + File .separator ;
316+
317+ if (modelFileFolder != null ) {
318+ modelFileFolderPath = modelFileFolderPath + modelFileFolder + File .separator ;
319+ }
320+ return modelFileFolderPath ;
307321 }
308322
309323 @ Override
0 commit comments