|
6 | 6 | import io.swagger.codegen.CodegenConfigLoader;
|
7 | 7 | import io.swagger.codegen.CodegenConstants;
|
8 | 8 | import io.swagger.codegen.v3.ClientOptInput;
|
| 9 | +import io.swagger.codegen.v3.CodegenArgument; |
9 | 10 | import io.swagger.codegen.v3.config.CodegenConfigurator;
|
10 | 11 | import io.swagger.codegen.v3.service.exception.BadRequestException;
|
11 | 12 | import io.swagger.models.Swagger;
|
@@ -198,6 +199,7 @@ public static ClientOptInput getClientOptInput(GenerationRequest generationReque
|
198 | 199 |
|
199 | 200 | if (isNotEmpty(lang)) {
|
200 | 201 | configurator.setLang(lang);
|
| 202 | + readCodegenArguments(configurator, options); |
201 | 203 | }
|
202 | 204 | if (isNotEmpty(options.getAuth())) {
|
203 | 205 | configurator.setAuth(options.getAuth());
|
@@ -286,4 +288,26 @@ public static ClientOptInput getClientOptInput(GenerationRequest generationReque
|
286 | 288 | LOGGER.debug("getClientOptInput - end");
|
287 | 289 | return configurator.toClientOptInput();
|
288 | 290 | }
|
| 291 | + |
| 292 | + private static void readCodegenArguments(CodegenConfigurator configurator, Options options) { |
| 293 | + if (options == null) { |
| 294 | + return; |
| 295 | + } |
| 296 | + io.swagger.codegen.v3.CodegenConfig config = io.swagger.codegen.v3.CodegenConfigLoader.forName(configurator.getLang()); |
| 297 | + if (config == null) { |
| 298 | + return; |
| 299 | + } |
| 300 | + final List<CodegenArgument> arguments = config.readLanguageArguments(); |
| 301 | + if (arguments == null || arguments.isEmpty()) { |
| 302 | + return; |
| 303 | + } |
| 304 | + for (CodegenArgument codegenArgument : arguments) { |
| 305 | + final String value = options.getCodegenArguments().get(codegenArgument.getOption().substring(2)); |
| 306 | + if (value == null) { |
| 307 | + continue; |
| 308 | + } |
| 309 | + codegenArgument.setValue(value); |
| 310 | + } |
| 311 | + configurator.setCodegenArguments(arguments); |
| 312 | + } |
289 | 313 | }
|
0 commit comments