diff --git a/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/codegen/OpenApiGeneratorCodeGenBase.java b/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/codegen/OpenApiGeneratorCodeGenBase.java index 20335555..7508a110 100644 --- a/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/codegen/OpenApiGeneratorCodeGenBase.java +++ b/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/codegen/OpenApiGeneratorCodeGenBase.java @@ -33,7 +33,6 @@ import io.quarkus.deployment.Capability; import io.quarkus.deployment.CodeGenContext; import io.quarkus.deployment.CodeGenProvider; -import io.quarkus.maven.dependency.ResolvedDependency; import io.smallrye.config.SmallRyeConfig; /** @@ -119,20 +118,18 @@ public boolean trigger(CodeGenContext context) throws CodeGenException { return false; } - private boolean isJacksonReactiveClientPresent(CodeGenContext context) { - return context.applicationModel().getDependencies().stream() - .anyMatch(this::isJacksonReactiveClient); + private static boolean isJacksonReactiveClientPresent(CodeGenContext context) { + return isExtensionCapabilityPresent(context, Capability.REST_CLIENT_REACTIVE_JACKSON); } - private boolean isJacksonClassicClientPresent(CodeGenContext context) { - return context.applicationModel().getExtensionCapabilities().stream() - .flatMap(extensionCapability -> extensionCapability.getProvidesCapabilities().stream()) - .anyMatch(Capability.RESTEASY_JSON_JACKSON_CLIENT::equals); + private static boolean isJacksonClassicClientPresent(CodeGenContext context) { + return isExtensionCapabilityPresent(context, Capability.RESTEASY_JSON_JACKSON_CLIENT); } - private boolean isJacksonReactiveClient(ResolvedDependency resolvedDependency) { - return "quarkus-rest-client-reactive-jackson".equals(resolvedDependency.getArtifactId()) - && "io.quarkus".equals(resolvedDependency.getGroupId()); + private static boolean isExtensionCapabilityPresent(CodeGenContext context, String capability) { + return context.applicationModel().getExtensionCapabilities().stream() + .flatMap(extensionCapability -> extensionCapability.getProvidesCapabilities().stream()) + .anyMatch(capability::equals); } // TODO: do not generate if the output dir has generated files and the openapi file has the same checksum of the previous run