Skip to content

Commit 76c522a

Browse files
authored
Changed to io.quarkiverse.openapi.generator.deployment.codegen.OpenApiGeneratorCodeGenBase.shouldRun return false instead of throwing exception (#346) (#348)
Signed-off-by: Helber Belmiro <[email protected]> (cherry picked from commit b2ebc2c)
1 parent 0adf656 commit 76c522a

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/codegen/OpenApiGeneratorCodeGenBase.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.eclipse.microprofile.config.Config;
2626
import org.openapitools.codegen.config.GlobalSettings;
2727

28-
import io.quarkiverse.openapi.generator.OpenApiGeneratorException;
2928
import io.quarkiverse.openapi.generator.deployment.CodegenConfig;
3029
import io.quarkiverse.openapi.generator.deployment.circuitbreaker.CircuitBreakerConfigurationParser;
3130
import io.quarkiverse.openapi.generator.deployment.wrapper.OpenApiClassicClientGeneratorWrapper;
@@ -69,19 +68,13 @@ public String inputDirectory() {
6968

7069
@Override
7170
public boolean shouldRun(Path sourceDir, Config config) {
72-
Optional<String> inputBaseDir = getInputBaseDirRelativeToModule(sourceDir, config);
73-
inputBaseDir.ifPresentOrElse(s -> {
74-
if (!Files.isDirectory(Path.of(s))) {
75-
throw new OpenApiGeneratorException(String.format("Invalid path on %s: %s", INPUT_BASE_DIR, s));
76-
}
77-
}, () -> {
78-
if (!Files.isDirectory(sourceDir)
79-
&& !sourceDir.endsWith(Path.of("src", "test", this.inputDirectory()))) {
80-
throw new OpenApiGeneratorException(String.format("Invalid path on %s: %s", INPUT_BASE_DIR, sourceDir));
81-
}
82-
});
71+
String inputBaseDir = getInputBaseDirRelativeToModule(sourceDir, config).orElse(null);
8372

84-
return true;
73+
if (inputBaseDir != null) {
74+
return Files.isDirectory(Path.of(inputBaseDir));
75+
} else {
76+
return Files.isDirectory(sourceDir) || sourceDir.endsWith(Path.of("src", "test", this.inputDirectory()));
77+
}
8578
}
8679

8780
protected boolean isRestEasyReactive(CodeGenContext context) {

0 commit comments

Comments
 (0)