forked from loafle/openapi-generator-original
Validate spec on generation by default (#251)
* Validate spec on generation by default Adds a validation parameter to CodegenConfigurator, and passes through options from CLI, Maven Plugin and Gradle Plugin to that property. Default is to validate the spec during generation. If spec has errors, we will output errors as well as warnings to the user. Option can be disabled by passing false to validateSpec (Maven/Gradle) or --validate-spec (CLI). * Prepare version 3.1.1-SNAPSHOT * fix version * Use last prod version for the sample * Update README.md Fix * [cli] Option parser does not support true/false for boolean options
This commit is contained in:
committed by
William Cheng
parent
a8e8acead7
commit
77df3d6770
@@ -60,6 +60,9 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CodeGenMojo.class);
|
||||
|
||||
@Parameter(name="validateSpec", required = false, defaultValue = "true")
|
||||
private Boolean validateSpec;
|
||||
|
||||
@Parameter(name = "verbose", required = false, defaultValue = "false")
|
||||
private boolean verbose;
|
||||
|
||||
@@ -348,6 +351,11 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
|
||||
configurator.setVerbose(verbose);
|
||||
|
||||
// now override with any specified parameters
|
||||
if (validateSpec != null) {
|
||||
configurator.setValidateSpec(validateSpec);
|
||||
}
|
||||
|
||||
if (skipOverwrite != null) {
|
||||
configurator.setSkipOverwrite(skipOverwrite);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user