forked from loafle/openapi-generator-original
Fixed indentation to use spaces instead of tabs
This commit is contained in:
parent
6db358dd39
commit
bff0e2ad19
@ -160,7 +160,7 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
|
|
||||||
Set<String> definedOptions = new HashSet<String>();
|
Set<String> definedOptions = new HashSet<String>();
|
||||||
for (CliOption langCliOption : config.cliOptions()) {
|
for (CliOption langCliOption : config.cliOptions()) {
|
||||||
definedOptions.add(langCliOption.getOpt());
|
definedOptions.add(langCliOption.getOpt());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configOptions != null) {
|
if (configOptions != null) {
|
||||||
@ -178,15 +178,15 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
Map<String, String> mappings = createMapFromKeyValuePairs(configOptions.remove("instantiation-types").toString());
|
Map<String, String> mappings = createMapFromKeyValuePairs(configOptions.remove("instantiation-types").toString());
|
||||||
config.instantiationTypes().putAll(mappings);
|
config.instantiationTypes().putAll(mappings);
|
||||||
}
|
}
|
||||||
addAdditionalProperties(config, definedOptions, configOptions);
|
addAdditionalProperties(config, definedOptions, configOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null != configurationFile) {
|
if (null != configurationFile) {
|
||||||
Config genConfig = ConfigParser.read(configurationFile);
|
Config genConfig = ConfigParser.read(configurationFile);
|
||||||
if (null != genConfig) {
|
if (null != genConfig) {
|
||||||
addAdditionalProperties(config, definedOptions, genConfig.getOptions());
|
addAdditionalProperties(config, definedOptions, genConfig.getOptions());
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("Unable to read configuration file");
|
throw new RuntimeException("Unable to read configuration file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,8 +205,8 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
new DefaultGenerator().opts(input).generate();
|
new DefaultGenerator().opts(input).generate();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Maven logs exceptions thrown by plugins only if invoked with -e
|
// Maven logs exceptions thrown by plugins only if invoked with -e
|
||||||
// I find it annoying to jump through hoops to get basic diagnostic information,
|
// I find it annoying to jump through hoops to get basic diagnostic information,
|
||||||
// so let's log it in any case:
|
// so let's log it in any case:
|
||||||
getLog().error(e);
|
getLog().error(e);
|
||||||
throw new MojoExecutionException("Code generation failed. See above for the full exception.");
|
throw new MojoExecutionException("Code generation failed. See above for the full exception.");
|
||||||
}
|
}
|
||||||
@ -217,12 +217,12 @@ public class CodeGenMojo extends AbstractMojo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addAdditionalProperties(CodegenConfig config, Set<String> definedOptions, Map<?,?> configOptions) {
|
private void addAdditionalProperties(CodegenConfig config, Set<String> definedOptions, Map<?,?> configOptions) {
|
||||||
for(Map.Entry<?, ?> configEntry : configOptions.entrySet()) {
|
for(Map.Entry<?, ?> configEntry : configOptions.entrySet()) {
|
||||||
config.additionalProperties().put(configEntry.getKey().toString(), configEntry.getValue());
|
config.additionalProperties().put(configEntry.getKey().toString(), configEntry.getValue());
|
||||||
if(!definedOptions.contains(configEntry.getKey())) {
|
if(!definedOptions.contains(configEntry.getKey())) {
|
||||||
getLog().warn("Additional property: " + configEntry.getKey() + " is not defined for this language.");
|
getLog().warn("Additional property: " + configEntry.getKey() + " is not defined for this language.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, String> createMapFromKeyValuePairs(String commaSeparatedKVPairs) {
|
private static Map<String, String> createMapFromKeyValuePairs(String commaSeparatedKVPairs) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user