diff --git a/client-subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/client/deployment/MicroProfileGraphQLClientDependencyProcessor.java b/client-subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/client/deployment/MicroProfileGraphQLClientDependencyProcessor.java index ce72e56..7faed4c 100644 --- a/client-subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/client/deployment/MicroProfileGraphQLClientDependencyProcessor.java +++ b/client-subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/client/deployment/MicroProfileGraphQLClientDependencyProcessor.java @@ -25,7 +25,6 @@ import org.jboss.as.server.deployment.annotation.CompositeIndex; import org.jboss.as.server.deployment.module.ModuleDependency; import org.jboss.as.server.deployment.module.ModuleSpecification; -import org.jboss.logging.Logger; import org.jboss.modules.ModuleLoader; import org.jboss.modules.Module; import org.wildfly.extension.microprofile.graphql.client._private.MicroProfileGraphQLClientLogger; @@ -44,7 +43,7 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro final ModuleLoader moduleLoader = Module.getBootModuleLoader(); ModuleDependency dependency = new ModuleDependency(moduleLoader, "org.wildfly.extension.microprofile.graphql-client-smallrye", false, false, true, false); // this is an equivalent of meta-inf="import" in jboss-deployment-structure.xml and is needed to be able to see CDI beans from the module - dependency.addImportFilter(s -> s.equals("META-INF"), true); + dependency.addImportFilter(s -> s.startsWith("META-INF"), true); moduleSpecification.addSystemDependency(dependency); } } diff --git a/feature-pack/src/main/resources/modules/system/layers/base/io/smallrye/graphql/client/common/main/module.xml b/feature-pack/src/main/resources/modules/system/layers/base/io/smallrye/graphql/client/common/main/module.xml index 7e4a220..d6a6d1b 100644 --- a/feature-pack/src/main/resources/modules/system/layers/base/io/smallrye/graphql/client/common/main/module.xml +++ b/feature-pack/src/main/resources/modules/system/layers/base/io/smallrye/graphql/client/common/main/module.xml @@ -23,7 +23,7 @@ - + diff --git a/feature-pack/src/main/resources/modules/system/layers/base/io/smallrye/graphql/client/vertx/main/module.xml b/feature-pack/src/main/resources/modules/system/layers/base/io/smallrye/graphql/client/vertx/main/module.xml index fcdcd39..b096f3e 100644 --- a/feature-pack/src/main/resources/modules/system/layers/base/io/smallrye/graphql/client/vertx/main/module.xml +++ b/feature-pack/src/main/resources/modules/system/layers/base/io/smallrye/graphql/client/vertx/main/module.xml @@ -25,7 +25,7 @@ - + diff --git a/quickstart-client/README.md b/quickstart-client/README.md index fe7b98c..4e5f26b 100644 --- a/quickstart-client/README.md +++ b/quickstart-client/README.md @@ -1,11 +1,14 @@ -# GraphQL quickstart +# GraphQL Client quickstart ## Prerequisites - JDK 1.8+ - Maven +## Quickstart's compatibility with server-side quickstart +This quickstart requires the server-side quickstart implementation to function properly. Instructions for deploying the feature pack on the server-side can be found in the server-side quickstart's [README](../quickstart/README.md). -## Building and deploying the quickstart + +## Building and deployment The [main README](../README.md) contains information about the layers in this feature pack. You can use the `wildfly-maven-plugin` to build and run the server with the feature pack, and deploy the quickstart war. @@ -13,238 +16,115 @@ The [main README](../README.md) contains information about the layers in this fe mvn wildfly:provision wildfly:dev ``` -## Check the GraphQL schema -To view the schema, execute this command: -``` -curl localhost:8080/quickstart/graphql/schema.graphql -``` - -## Experimenting with queries using GraphiQL -GraphiQL is a UI tool that can be used to execute GraphQL queries. Open GraphiQL by navigating to -`http://localhost:8080/quickstart/graphql-ui` in your browser. Queries that you should try out are listed below. -You will probably also notice that GraphiQL, based on the knowledge of the GraphQL schema, offers autocompletion! - -### Queries -Enter the following query to GraphiQL and press the play button: - -``` -query allFilms { - allFilms { - title - director - releaseDate - episodeID - } -} -``` - -Note: The equivalent query can be executed via curl by -``` -curl -X POST localhost:8080/quickstart/graphql -d'{"query": "{allFilms{title director releaseDate episodeID}}"}' -``` +## Functionality +The quickstart-client.war application exposes various REST endpoints that demonstrate interacting with the server-side GraphQL API through the SmallRye GraphQL Client. +The endpoints utilize both typesafe and dynamic client approaches. +### Typesafe API -Since our query contains all the fields in the Film class we will retrieve all the fields in our response. -Since GraphQL API responses are client determined, the client can choose which fields it will require. +The typesafe client functions like a MicroProfile REST Client but is tailored for GraphQL endpoints. To use it, you will need domain model classes that match the GraphQL schema. -Let’s assume that our client only requires `title` and `releaseDate` making the previous call to the API -Over-fetching of unnecessary data. +Think of a client instance as a proxy. You interact with it as you would a regular Java object, and it translates your calls into GraphQL operations. -Enter the following query into GraphiQL and hit the play button: +It directly handles domain classes, translating input and output data between Java objects and their representations in the GraphQL query language. +#### Example -``` -query allFilms { - allFilms { - title - releaseDate - } -} -``` +Let's start by defining a domain class `Film` to represent the data we will be working with. +```java +package org.wildfly.extras.quickstart.microprofile.graphql.client; -Notice in the response we have only retrieved the required fields. Therefore, we have prevented Over-fetching. +import java.time.LocalDate; -Let's now try out a way how to retrieve one film my its id. It's implemented by this query: +public class Film { + String title; + Integer episodeID; + String director; + LocalDate releaseDate; + String desc; +} ``` -@Query -@Description("Get a Films from a galaxy far far away") -public Film getFilm(@Name("filmId") int id) { - return service.getFilm(id); -} +Next, create a GraphQL client API interface `FilmClientApi` to define the GraphQL operations: +```java +@GraphQLClientApi +interface FilmClientApi { + @Query + List getAllFilms(); +} ``` -Enter the following into GraphiQL and make a request. - +Finally, implement a REST endpoint to expose the GraphQL client's functionality: +```java +@GET +@Path("/typesafe/films") +@Produces(MediaType.APPLICATION_JSON) +public List getAllFilms() { + FilmClientApi client = TypesafeGraphQLClientBuilder.newBuilder() + .endpoint(url) // http://localhost:8080/quickstart/graphql + .build(FilmClientApi.class); + return client.getAllFilms(); +} ``` -query getFilm { - film(filmId: 1) { - title - director - releaseDate - episodeID - } -} +You can test the endpoint using a tool like curl: ``` - -The film query method requested fields can be determined as such in our previous example. -This way we can retrieve individual film information. - -However, say our client requires both films with filmId 0 and 1. In a REST API the client would have to make -two calls to the API. Therefore, the client would be Under-fetching. - -In GraphQL it is possible to make multiple queries at once. - -Enter the following into GraphiQL to retrieve two films: - -``` -query getFilms { - film0: film(filmId: 0) { - title - director - releaseDate - episodeID - } - film1: film(filmId: 1) { - title - director - releaseDate - episodeID - } -} +curl localhost:8080/quickstart-client/typesafe/films ``` - -This enabled the client to fetch the required data in a single request. - -Until now, we have created a GraphQL API to retrieve film data. -We now want to enable the clients to retrieve the Hero data of the Film. - -Review the following source-query in our `FilmResource` class: - +The typesafe client will automatically generate the corresponding GraphQL query based on the operation's return type and domain classes: ``` -public List heroes(@Source Film film) { - return service.getHeroesByFilm(film); +query allFilms { + allFilms { + title + pisodeID + director + releaseDate + desc + } } ``` -Enter the following into GraphiQL to retrieve the film and hero data. - -``` -query getFilmHeroes { - film(filmId: 1) { - title - director - releaseDate - episodeID - heroes { - name - height - mass - darkSide - lightSaber +The proxy will then send this query as part of the GraphQL request to the server. The server will process the request and return a GraphQL response. +The response will be deserialized into Java objects. + +Other endpoints: +- **`localhost:8080/typesafe/films/{id}`:** Retrieves a specific film by its index. +- **`localhost:8080/typesafe/delete/hero/{id}`:** Deletes a hero by its index. +- **`localhost:8080/typesafe/heroes/{surname}`:** Retrieves a list of heroes with a specific surname. + +### Dynamic API +Unlike the typesafe API, the dynamic client does not require a client API interface or domain classes. It operates directly with abstract representations of GraphQL documents, constructed using a domain-specific language (DSL). +Exchanged objects are treated as abstract `JsonObject`, but can be converted to concrete model objects if necessary. +#### Example +```java +@GET +@Path("/dynamic/films/{id}") +@Produces(MediaType.APPLICATION_JSON) +public Film getFilmDynamic(@PathParam("id") int id) throws ExecutionException, InterruptedException { + try (VertxDynamicGraphQLClient dynamicGraphQLClient = + (VertxDynamicGraphQLClient) new VertxDynamicGraphQLClientBuilder() + .url(url) + .build() + ) { + + Variable filmId = var("filmId", nonNull(ScalarType.GQL_INT)); + + Document query = document( + operation("film", vars(filmId), + field("film", args(arg("filmId", filmId)), + field("title"), + field("episodeID"), + field("director"), + field("releaseDate"), + field("desc") + ) + ) + ); + Response response = dynamicGraphQLClient.executeSync(query, Collections.singletonMap("filmId", id)); + return response.getObject(Film.class, "film"); } - } -} -``` - -The response now includes the heroes of the film. - -### Mutations - -Mutations are used when data is created, updated or deleted. -Review the following mutations in our `FilmResource` class: - -``` -@Mutation -public Hero createHero(Hero hero) { - service.addHero(hero); - return hero; } - -@Mutation -public Hero deleteHero(int id) { - return service.deleteHero(id); -} -``` - -Enter the following into GraphiQL to insert a Hero: - -``` -mutation addHero { - createHero(hero: { - name: "Han", - surname: "Solo" - height: 1.85 - mass: 80 - darkSide: false - episodeIds: [4, 5, 6] - } - ) - { - name - surname - } -} -``` - -By using this mutation we have created a Hero entity in our service. - -Notice how in the response we have retrieved the name and surname of the created Hero. -This is because we selected to retrieve these fields in the response within the `{ }` -in the mutation query. This can easily be a server side generated field that the client may require. - -Let’s now try deleting an entry: - ``` -mutation DeleteHero { - deleteHero(id :3){ - name - surname - } -} +You can test the endpoint using a tool like curl: ``` - -Similar to the `createHero` mutation method we also retrieve the name and surname of the hero -we have deleted which is defined in { }. - -### Creating Queries by fields - -Queries can also be done on individual fields. For example, let’s create a method to -query heroes by their last name. - -Review the following snippet from the FilmResource class: - -``` -@Query -public List getHeroesWithSurname(@DefaultValue("Skywalker") String surname) { - return service.getHeroesBySurname(surname); -} -``` - -By using the `@DefaultValue` annotation we have determined that the surname value -will be Skywalker when the parameter is not provided. - -Test the following queries with GraphiQL: - +curl localhost:8080/quickstart-client/dynamic/films/{id} ``` -query heroWithDefaultSurname { - heroesWithSurname{ - name - surname - lightSaber - } -} -query heroWithSurnames { - heroesWithSurname(surname: "Vader") { - name - surname - lightSaber - } -} -``` - -## Conclusion -MicroProfile GraphQL enables clients to retrieve the exact data that is required preventing -Over-fetching and Under-fetching. - -The GraphQL API can be expanded without breaking previous queries enabling easy API evolution. diff --git a/quickstart-client/pom.xml b/quickstart-client/pom.xml index fe9555d..34a5c60 100644 --- a/quickstart-client/pom.xml +++ b/quickstart-client/pom.xml @@ -77,105 +77,23 @@ smallrye-graphql-client-implementation-vertx provided - - io.smallrye - smallrye-graphql-client-model - ${version.io.smallrye.graphql} - provided - - - org.eclipse.microprofile.graphql - microprofile-graphql-api - provided - - - - + + + + - io.smallrye.reactive - mutiny - provided - - - org.reactivestreams - reactive-streams - provided - - - - jakarta.json - jakarta.json-api - provided - - - - jakarta.enterprise - jakarta.enterprise.cdi-api - provided - - - jakarta.inject - jakarta.inject-api - provided - - - io.vertx - vertx-core - provided - - - - - io.smallrye - smallrye-graphql-ui-graphiql - compile - - - - - - - jakarta.validation - jakarta.validation-api + org.eclipse.microprofile.graphql + microprofile-graphql-api provided - jakarta.ws.rs jakarta.ws.rs-api provided - - - - org.wildfly.arquillian - wildfly-arquillian-container-managed - test - - - org.jboss.arquillian.junit - arquillian-junit-container - test - - - junit - junit - test - - - org.wildfly.arquillian - wildfly-arquillian-protocol-jmx - test - - - io.smallrye - smallrye-graphql-api - - quickstart-client diff --git a/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/FilmClientApi.java b/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/FilmClientApi.java index 9fcab06..4dd0ed8 100644 --- a/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/FilmClientApi.java +++ b/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/FilmClientApi.java @@ -3,10 +3,11 @@ import java.util.List; import io.smallrye.graphql.client.typesafe.api.GraphQLClientApi; -import org.eclipse.microprofile.graphql.DefaultValue; import org.eclipse.microprofile.graphql.Mutation; import org.eclipse.microprofile.graphql.Name; import org.eclipse.microprofile.graphql.Query; +import org.wildfly.extras.quickstart.microprofile.graphql.client.model.Film; +import org.wildfly.extras.quickstart.microprofile.graphql.client.model.Hero; @GraphQLClientApi interface FilmClientApi { @@ -16,12 +17,9 @@ interface FilmClientApi { @Query Film getFilm(@Name("filmId") int id); -// @Mutation -// Hero createHero(Hero hero); -// -// @Mutation -// Hero deleteHero(int id); -// -// @Query -// List getHeroesWithSurname(@DefaultValue("Skywalker") String surname); + @Mutation + Hero deleteHero(int id); + + @Query + List getHeroesWithSurname(String surname); } diff --git a/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/FilmResource.java b/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/FilmResource.java index df444dc..93df3fb 100644 --- a/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/FilmResource.java +++ b/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/FilmResource.java @@ -1,27 +1,22 @@ package org.wildfly.extras.quickstart.microprofile.graphql.client; -import io.smallrye.graphql.client.GraphQLClient; import io.smallrye.graphql.client.Response; import io.smallrye.graphql.client.core.Document; import io.smallrye.graphql.client.core.ScalarType; import io.smallrye.graphql.client.core.Variable; import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClient; import io.smallrye.graphql.client.dynamic.api.DynamicGraphQLClientBuilder; -import io.smallrye.graphql.client.model.ClientModels; -import io.smallrye.graphql.client.typesafe.api.ErrorOr; -import io.smallrye.graphql.client.vertx.dynamic.VertxDynamicGraphQLClient; -import io.smallrye.graphql.client.vertx.dynamic.VertxDynamicGraphQLClientBuilder; -import io.smallrye.graphql.client.vertx.typesafe.VertxTypesafeGraphQLClientBuilder; -import jakarta.inject.Inject; +import io.smallrye.graphql.client.typesafe.api.TypesafeGraphQLClientBuilder; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; +import org.wildfly.extras.quickstart.microprofile.graphql.client.model.Film; +import org.wildfly.extras.quickstart.microprofile.graphql.client.model.Hero; import java.util.Collections; import java.util.List; -import java.util.concurrent.ExecutionException; import static io.smallrye.graphql.client.core.Argument.arg; import static io.smallrye.graphql.client.core.Argument.args; @@ -30,13 +25,11 @@ import static io.smallrye.graphql.client.core.Operation.operation; import static io.smallrye.graphql.client.core.Variable.var; import static io.smallrye.graphql.client.core.Variable.vars; +import static io.smallrye.graphql.client.core.VariableType.nonNull; @Path("/") public class FilmResource { - @Inject - ClientModels clientModels; - private static final String url; static { @@ -49,8 +42,7 @@ public class FilmResource { @Produces(MediaType.APPLICATION_JSON) public List getAllFilms() { System.out.println("Using URL " + url); - FilmClientApi client = new VertxTypesafeGraphQLClientBuilder() - .clientModels(clientModels) + FilmClientApi client = TypesafeGraphQLClientBuilder.newBuilder() .endpoint(url) .build(FilmClientApi.class); return client.getAllFilms(); @@ -61,54 +53,44 @@ public List getAllFilms() { @Produces(MediaType.APPLICATION_JSON) public Film getFilm(@PathParam("id") int index) { System.out.println("Using URL " + url); - FilmClientApi client = new VertxTypesafeGraphQLClientBuilder() - .clientModels(clientModels) + FilmClientApi client = TypesafeGraphQLClientBuilder.newBuilder() .endpoint(url) .build(FilmClientApi.class); return client.getFilm(index); } -// @GET -// @Path("/typesafe/delete/hero/{heroId}") -// @Produces(MediaType.APPLICATION_JSON) -// public Hero deleteFilm(@PathParam("heroId") int id) { -// System.out.println("Using URL " + url); -// FilmClientApi client = new VertxTypesafeGraphQLClientBuilder() -// .clientModels(clientModels) -// .endpoint(url) -// .build(FilmClientApi.class); -// return client.deleteHero(id); -// } -// -// @GET -// @Path("/typesafe/heroes/{surname}") -// @Produces(MediaType.APPLICATION_JSON) -// public List getHeroesWithSurname(@PathParam("surname") String surname) { -// System.out.println("Using URL " + url); -// FilmClientApi client = new VertxTypesafeGraphQLClientBuilder() -// .clientModels(clientModels) -// .endpoint(url) -// .build(FilmClientApi.class); -// return client.getHeroesWithSurname(surname); -// } + @GET + @Path("/typesafe/delete/hero/{id}") + @Produces(MediaType.APPLICATION_JSON) + public Hero deleteFilm(@PathParam("id") int id) { + System.out.println("Using URL " + url); + FilmClientApi client = TypesafeGraphQLClientBuilder.newBuilder() + .endpoint(url) + .build(FilmClientApi.class); + return client.deleteHero(id); + } -// @Inject -// @GraphQLClient("star-wars-dynamic") -// DynamicGraphQLClient dynamicClient; + @GET + @Path("/typesafe/heroes/{surname}") + @Produces(MediaType.APPLICATION_JSON) + public List getHeroesWithSurname(@PathParam("surname") String surname) { + System.out.println("Using URL " + url); + FilmClientApi client = TypesafeGraphQLClientBuilder.newBuilder() + .endpoint(url) + .build(FilmClientApi.class); + return client.getHeroesWithSurname(surname); + } @GET @Path("/dynamic/films/{id}") @Produces(MediaType.APPLICATION_JSON) - public Film getFilmDynamic(@PathParam("id") int id) throws ExecutionException, InterruptedException { - Response response; - try (VertxDynamicGraphQLClient dynamicGraphQLClient = (VertxDynamicGraphQLClient) new VertxDynamicGraphQLClientBuilder().url(url).build()) { - //// (VertxDynamicGraphQLClient) DynamicGraphQLClientBuilder - //// .newBuilder() - //// .url(url) - //// .build(); - - Variable filmId = var("filmId", ScalarType.GQL_INT); - + public Film getFilmDynamic(@PathParam("id") int id) throws Exception { + try (DynamicGraphQLClient dynamicGraphQLClient = DynamicGraphQLClientBuilder + .newBuilder() + .url(url) + .build() + ){ + Variable filmId = var("filmId", nonNull(ScalarType.GQL_INT)); Document query = document( operation("film", vars(filmId), field("film", args(arg("filmId", filmId)), @@ -120,8 +102,8 @@ public Film getFilmDynamic(@PathParam("id") int id) throws ExecutionException, I ) ) ); - response = dynamicGraphQLClient.executeSync(query, Collections.singletonMap("filmId", id)); + Response response = dynamicGraphQLClient.executeSync(query, Collections.singletonMap("filmId", id)); + return response.getObject(Film.class, "film"); } - return response.getObject(Film.class, "film"); } } diff --git a/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/Film.java b/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/model/Film.java similarity index 99% rename from quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/Film.java rename to quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/model/Film.java index e209fa0..173a355 100644 --- a/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/Film.java +++ b/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/model/Film.java @@ -1,4 +1,4 @@ -package org.wildfly.extras.quickstart.microprofile.graphql.client; +package org.wildfly.extras.quickstart.microprofile.graphql.client.model; import java.time.LocalDate; diff --git a/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/Hero.java b/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/model/Hero.java similarity index 99% rename from quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/Hero.java rename to quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/model/Hero.java index c62c600..543772f 100644 --- a/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/Hero.java +++ b/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/model/Hero.java @@ -1,4 +1,4 @@ -package org.wildfly.extras.quickstart.microprofile.graphql.client; +package org.wildfly.extras.quickstart.microprofile.graphql.client.model; import java.util.ArrayList; diff --git a/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/LightSaber.java b/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/model/LightSaber.java similarity index 93% rename from quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/LightSaber.java rename to quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/model/LightSaber.java index 51ee5d3..cbcf7f8 100644 --- a/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/LightSaber.java +++ b/quickstart-client/src/main/java/org/wildfly/extras/quickstart/microprofile/graphql/client/model/LightSaber.java @@ -1,4 +1,4 @@ -package org.wildfly.extras.quickstart.microprofile.graphql.client; +package org.wildfly.extras.quickstart.microprofile.graphql.client.model; public enum LightSaber { RED, BLUE, GREEN, PURPLE diff --git a/quickstart-client/src/main/resources/META-INF/microprofile-config.properties b/quickstart-client/src/main/resources/META-INF/microprofile-config.properties index 1e0f5d4..e69de29 100644 --- a/quickstart-client/src/main/resources/META-INF/microprofile-config.properties +++ b/quickstart-client/src/main/resources/META-INF/microprofile-config.properties @@ -1,4 +0,0 @@ -# Example configuration file for a GraphQL application for WildFly -# for all config options, see SmallRye GraphQL documentation - -== \ No newline at end of file diff --git a/quickstart-client/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/quickstart-client/src/main/webapp/WEB-INF/jboss-deployment-structure.xml index cbd9f04..f9d9428 100644 --- a/quickstart-client/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ b/quickstart-client/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -2,6 +2,8 @@ + + \ No newline at end of file diff --git a/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/MicroProfileGraphQLSubsystemDefinition.java b/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/MicroProfileGraphQLSubsystemDefinition.java index f6953f5..eb87ac4 100644 --- a/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/MicroProfileGraphQLSubsystemDefinition.java +++ b/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/MicroProfileGraphQLSubsystemDefinition.java @@ -29,9 +29,9 @@ import org.jboss.as.server.deployment.Phase; import org.jboss.dmr.ModelNode; import org.wildfly.extension.microprofile.graphql._private.MicroProfileGraphQLLogger; -import org.wildfly.extension.microprofile.graphql.client.deployment.GraphiQLUIDeploymentProcessor; -import org.wildfly.extension.microprofile.graphql.client.deployment.MicroProfileGraphQLDependencyProcessor; -import org.wildfly.extension.microprofile.graphql.client.deployment.MicroProfileGraphQLDeploymentProcessor; +import org.wildfly.extension.microprofile.graphql.deployment.GraphiQLUIDeploymentProcessor; +import org.wildfly.extension.microprofile.graphql.deployment.MicroProfileGraphQLDependencyProcessor; +import org.wildfly.extension.microprofile.graphql.deployment.MicroProfileGraphQLDeploymentProcessor; import java.util.Collection; import java.util.Collections; diff --git a/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/client/deployment/GraphiQLUIDeploymentProcessor.java b/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/deployment/GraphiQLUIDeploymentProcessor.java similarity index 98% rename from subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/client/deployment/GraphiQLUIDeploymentProcessor.java rename to subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/deployment/GraphiQLUIDeploymentProcessor.java index e6b92e3..391f32a 100644 --- a/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/client/deployment/GraphiQLUIDeploymentProcessor.java +++ b/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/deployment/GraphiQLUIDeploymentProcessor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.wildfly.extension.microprofile.graphql.client.deployment; +package org.wildfly.extension.microprofile.graphql.deployment; import org.jboss.as.ee.component.EEModuleDescription; import org.jboss.as.ee.structure.DeploymentType; diff --git a/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/client/deployment/MicroProfileGraphQLDependencyProcessor.java b/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/deployment/MicroProfileGraphQLDependencyProcessor.java similarity index 89% rename from subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/client/deployment/MicroProfileGraphQLDependencyProcessor.java rename to subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/deployment/MicroProfileGraphQLDependencyProcessor.java index be3f46e..961829a 100644 --- a/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/client/deployment/MicroProfileGraphQLDependencyProcessor.java +++ b/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/deployment/MicroProfileGraphQLDependencyProcessor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.wildfly.extension.microprofile.graphql.client.deployment; +package org.wildfly.extension.microprofile.graphql.deployment; import org.jboss.as.server.deployment.Attachments; import org.jboss.as.server.deployment.DeploymentPhaseContext; @@ -27,7 +27,7 @@ import org.jboss.modules.Module; import org.jboss.modules.ModuleLoader; -import static org.wildfly.extension.microprofile.graphql.client.deployment.MicroProfileGraphQLDeploymentProcessor.ANNOTATION_GRAPHQL_API; +import static org.wildfly.extension.microprofile.graphql.deployment.MicroProfileGraphQLDeploymentProcessor.ANNOTATION_GRAPHQL_API; public class MicroProfileGraphQLDependencyProcessor implements DeploymentUnitProcessor { @@ -40,7 +40,7 @@ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitPro final ModuleLoader moduleLoader = Module.getBootModuleLoader(); ModuleDependency dependency = new ModuleDependency(moduleLoader, "io.smallrye.graphql", false, false, true, false); // this is an equivalent of meta-inf="import" in jboss-deployment-structure.xml and is needed to be able to see CDI beans from the module - dependency.addImportFilter(s -> s.equals("META-INF"), true); + dependency.addImportFilter(s -> s.startsWith("META-INF"), true); moduleSpecification.addSystemDependency(dependency); } } diff --git a/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/client/deployment/MicroProfileGraphQLDeploymentProcessor.java b/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/deployment/MicroProfileGraphQLDeploymentProcessor.java similarity index 99% rename from subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/client/deployment/MicroProfileGraphQLDeploymentProcessor.java rename to subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/deployment/MicroProfileGraphQLDeploymentProcessor.java index 9e04ba6..638da22 100644 --- a/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/client/deployment/MicroProfileGraphQLDeploymentProcessor.java +++ b/subsystem/src/main/java/org/wildfly/extension/microprofile/graphql/deployment/MicroProfileGraphQLDeploymentProcessor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.wildfly.extension.microprofile.graphql.client.deployment; +package org.wildfly.extension.microprofile.graphql.deployment; import io.smallrye.graphql.entry.http.ExecutionServlet; import io.smallrye.graphql.entry.http.SchemaServlet;