Skip to content

Commit

Permalink
Add Panache Sort enums in index for SmallRye GraphQL
Browse files Browse the repository at this point in the history
It's typically something that could be used as a parameter.

Fixes quarkusio#36688
  • Loading branch information
gsmet authored and carlesarnal committed Feb 4, 2025
1 parent 18724ca commit 7e06dc9
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.quarkus.smallrye.graphql.deployment;

import static io.smallrye.graphql.schema.helper.TypeAutoNameStrategy.valueOf;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -34,6 +32,7 @@
import io.quarkus.arc.deployment.BeanDefiningAnnotationBuildItem;
import io.quarkus.arc.deployment.UnremovableBeanBuildItem;
import io.quarkus.arc.processor.BuiltinScope;
import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
import io.quarkus.deployment.Capabilities;
import io.quarkus.deployment.Capability;
import io.quarkus.deployment.Feature;
Expand All @@ -43,6 +42,7 @@
import io.quarkus.deployment.annotations.Consume;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.AdditionalIndexedClassesBuildItem;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem;
Expand Down Expand Up @@ -868,6 +868,18 @@ void registerGraphQLUiHandler(
}
}

@BuildStep
void indexPanacheClasses(BuildProducer<AdditionalIndexedClassesBuildItem> additionalIndexedClasses) {
// so that they can be used in SmallRye GraphQL queries
if (QuarkusClassLoader.isClassPresentAtRuntime("io.quarkus.panache.common.Sort$Direction")) {
additionalIndexedClasses.produce(new AdditionalIndexedClassesBuildItem("io.quarkus.panache.common.Sort$Direction"));
}
if (QuarkusClassLoader.isClassPresentAtRuntime("io.quarkus.panache.common.Sort$NullPrecedence")) {
additionalIndexedClasses
.produce(new AdditionalIndexedClassesBuildItem("io.quarkus.panache.common.Sort$NullPrecedence"));
}
}

// In dev mode, when you click on the logo, you should go to Dev UI
private String getLogoUrl(LaunchModeBuildItem launchMode, String devUIValue, String defaultValue) {
if (launchMode.getLaunchMode().equals(LaunchMode.DEVELOPMENT)) {
Expand Down

0 comments on commit 7e06dc9

Please sign in to comment.