Skip to content

Commit 64fafb5

Browse files
committed
[all] sys props in CodegenConstants
1 parent a0d5079 commit 64fafb5

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin/CodeGenMojo.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -405,28 +405,28 @@ public void execute() throws MojoExecutionException {
405405

406406
// Set generation options
407407
if (null != generateApis && generateApis) {
408-
System.setProperty("apis", "");
408+
System.setProperty(CodegenConstants.APIS, "");
409409
} else {
410-
System.clearProperty("apis");
410+
System.clearProperty(CodegenConstants.APIS);
411411
}
412412

413413
if (null != generateModels && generateModels) {
414-
System.setProperty("models", modelsToGenerate);
414+
System.setProperty(CodegenConstants.MODELS, modelsToGenerate);
415415
} else {
416-
System.clearProperty("models");
416+
System.clearProperty(CodegenConstants.MODELS);
417417
}
418418

419419
if (null != generateSupportingFiles && generateSupportingFiles) {
420-
System.setProperty("supportingFiles", supportingFilesToGenerate);
420+
System.setProperty(CodegenConstants.SUPPORTING_FILES, supportingFilesToGenerate);
421421
} else {
422-
System.clearProperty("supportingFiles");
422+
System.clearProperty(CodegenConstants.SUPPORTING_FILES);
423423
}
424424

425-
System.setProperty("modelTests", generateModelTests.toString());
426-
System.setProperty("modelDocs", generateModelDocumentation.toString());
427-
System.setProperty("apiTests", generateApiTests.toString());
428-
System.setProperty("apiDocs", generateApiDocumentation.toString());
429-
System.setProperty("withXml", withXml.toString());
425+
System.setProperty(CodegenConstants.MODEL_TESTS, generateModelTests.toString());
426+
System.setProperty(CodegenConstants.MODEL_DOCS, generateModelDocumentation.toString());
427+
System.setProperty(CodegenConstants.API_TESTS, generateApiTests.toString());
428+
System.setProperty(CodegenConstants.API_DOCS, generateApiDocumentation.toString());
429+
System.setProperty(CodegenConstants.WITH_XML, withXml.toString());
430430

431431
if (configOptions != null) {
432432
// Retained for backwards-compataibility with configOptions -> instantiation-types

modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenConstants.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44
* A class for storing constants that are used throughout the project.
55
*/
66
public class CodegenConstants {
7+
/* System Properties */
8+
// NOTE: We may want to move these to a separate class to avoid confusion or modification.
79
public static final String APIS = "apis";
810
public static final String MODELS = "models";
911
public static final String SUPPORTING_FILES = "supportingFiles";
1012
public static final String MODEL_TESTS = "modelTests";
1113
public static final String MODEL_DOCS = "modelDocs";
1214
public static final String API_TESTS = "apiTests";
1315
public static final String API_DOCS = "apiDocs";
16+
public static final String WITH_XML = "withXml";
17+
/* /end System Properties */
1418

1519
public static final String API_PACKAGE = "apiPackage";
1620
public static final String API_PACKAGE_DESC = "package for generated api classes";

modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ private void generateSupportingFiles(List<File> files, Map<String, Object> bundl
543543
return;
544544
}
545545
Set<String> supportingFilesToGenerate = null;
546-
String supportingFiles = System.getProperty("supportingFiles");
546+
String supportingFiles = System.getProperty(CodegenConstants.SUPPORTING_FILES);
547547
if (supportingFiles != null && !supportingFiles.isEmpty()) {
548548
supportingFilesToGenerate = new HashSet<String>(Arrays.asList(supportingFiles.split(",")));
549549
}

0 commit comments

Comments
 (0)