|
13 | 13 | import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyInstantiationTypesKvpList;
|
14 | 14 | import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyLanguageSpecificPrimitivesCsv;
|
15 | 15 | import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyLanguageSpecificPrimitivesCsvList;
|
16 |
| -import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyOpenAPINormalizerKvpList; |
17 | 16 | import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyReservedWordsMappingsKvp;
|
18 | 17 | import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyReservedWordsMappingsKvpList;
|
19 | 18 | import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applySchemaMappingsKvp;
|
|
74 | 73 | import org.openapitools.codegen.auth.AuthParser;
|
75 | 74 | import org.openapitools.codegen.config.CodegenConfigurator;
|
76 | 75 | import org.openapitools.codegen.config.GlobalSettings;
|
| 76 | +import org.openapitools.codegen.utils.OptionUtils; |
77 | 77 | import org.sonatype.plexus.build.incremental.BuildContext;
|
78 | 78 | import org.sonatype.plexus.build.incremental.DefaultBuildContext;
|
79 | 79 |
|
@@ -573,13 +573,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
|
573 | 573 | java.nio.file.Files.copy(inputSpecFile.toPath(), copyTo.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
574 | 574 | }
|
575 | 575 |
|
576 |
| - // attempt to read from config file |
577 |
| - CodegenConfigurator configurator = CodegenConfigurator.fromFile(configurationFile); |
578 |
| - |
579 |
| - // if a config file wasn't specified or we were unable to read it |
580 |
| - if (configurator == null) { |
581 |
| - configurator = new CodegenConfigurator(); |
582 |
| - } |
| 576 | + final CodegenConfigurator configurator = loadCodegenConfigurator(); |
583 | 577 |
|
584 | 578 | configurator.setVerbose(verbose);
|
585 | 579 |
|
@@ -857,7 +851,10 @@ public void execute() throws MojoExecutionException, MojoFailureException {
|
857 | 851 | }
|
858 | 852 |
|
859 | 853 | if (openapiNormalizer != null && (configOptions == null || !configOptions.containsKey("openapi-normalizer"))) {
|
860 |
| - applyOpenAPINormalizerKvpList(openapiNormalizer, configurator); |
| 854 | + for (String propString: openapiNormalizer) { |
| 855 | + OptionUtils.parseCommaSeparatedTuples(propString) |
| 856 | + .forEach(p -> {configurator.addOpenapiNormalizer(p.getLeft(), p.getRight());}); |
| 857 | + } |
861 | 858 | }
|
862 | 859 |
|
863 | 860 | // Apply Schema Mappings
|
@@ -953,6 +950,16 @@ public void execute() throws MojoExecutionException, MojoFailureException {
|
953 | 950 | }
|
954 | 951 | }
|
955 | 952 |
|
| 953 | + /** |
| 954 | + * Attempt to read from config file, return default otherwise. |
| 955 | + * |
| 956 | + * @return The CodegenConfigurator loaded from file or a default. |
| 957 | + */ |
| 958 | + private CodegenConfigurator loadCodegenConfigurator() { |
| 959 | + CodegenConfigurator configurator = CodegenConfigurator.fromFile(configurationFile); |
| 960 | + return configurator != null ? configurator : new CodegenConfigurator(); |
| 961 | + } |
| 962 | + |
956 | 963 | protected Collection<String> getGeneratorSpecificSupportingFiles() {
|
957 | 964 | return Collections.emptySet();
|
958 | 965 | }
|
|
0 commit comments