From 93f4d71fc8bf57b0d5f6cbbb7ec91cc01b4193c9 Mon Sep 17 00:00:00 2001 From: Ruediger zu Dohna Date: Sat, 13 Jan 2024 17:04:54 +0100 Subject: [PATCH] fix #1996: add missing federation directives to index --- .../graphql/entry/http/IndexInitializer.java | 13 ++++++++++++- .../graphql/tests/calendar/CalendarTest.java | 5 +++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/server/implementation-servlet/src/main/java/io/smallrye/graphql/entry/http/IndexInitializer.java b/server/implementation-servlet/src/main/java/io/smallrye/graphql/entry/http/IndexInitializer.java index 44c1fd32e..a14725c16 100644 --- a/server/implementation-servlet/src/main/java/io/smallrye/graphql/entry/http/IndexInitializer.java +++ b/server/implementation-servlet/src/main/java/io/smallrye/graphql/entry/http/IndexInitializer.java @@ -29,11 +29,16 @@ import org.jboss.jandex.Indexer; import io.smallrye.graphql.api.Entry; +import io.smallrye.graphql.api.federation.ComposeDirective; import io.smallrye.graphql.api.federation.Extends; import io.smallrye.graphql.api.federation.External; +import io.smallrye.graphql.api.federation.Inaccessible; +import io.smallrye.graphql.api.federation.InterfaceObject; import io.smallrye.graphql.api.federation.Key; import io.smallrye.graphql.api.federation.Provides; import io.smallrye.graphql.api.federation.Requires; +import io.smallrye.graphql.api.federation.Shareable; +import io.smallrye.graphql.api.federation.Tag; /** * This creates an index from the classpath. @@ -81,12 +86,18 @@ private IndexView createCustomIndex() { indexer.index(convertClassToInputStream(Entry.class)); indexer.index(convertClassToInputStream(Repeatable.class)); - // things from the API module + // directives from the API module + indexer.index(convertClassToInputStream(ComposeDirective.class)); indexer.index(convertClassToInputStream(Extends.class)); indexer.index(convertClassToInputStream(External.class)); + indexer.index(convertClassToInputStream(Inaccessible.class)); + indexer.index(convertClassToInputStream(InterfaceObject.class)); indexer.index(convertClassToInputStream(Key.class)); + indexer.index(convertClassToInputStream(Override.class)); indexer.index(convertClassToInputStream(Provides.class)); indexer.index(convertClassToInputStream(Requires.class)); + indexer.index(convertClassToInputStream(Shareable.class)); + indexer.index(convertClassToInputStream(Tag.class)); } catch (IOException ex) { throw new RuntimeException(ex); } diff --git a/server/integration-tests/src/test/java/io/smallrye/graphql/tests/calendar/CalendarTest.java b/server/integration-tests/src/test/java/io/smallrye/graphql/tests/calendar/CalendarTest.java index a9655810a..e7a773223 100644 --- a/server/integration-tests/src/test/java/io/smallrye/graphql/tests/calendar/CalendarTest.java +++ b/server/integration-tests/src/test/java/io/smallrye/graphql/tests/calendar/CalendarTest.java @@ -53,7 +53,7 @@ public void queryWithFormattedCalendarReturnTypeAndArgumentTest() { GraphQLAssured graphQLAssured = new GraphQLAssured(testingURL); String response = graphQLAssured .post("{ someFormattedCalendar(calendar: \"2023 04 at 13 hours\") }"); - assertThat(response).contains("{\"data\":{\"someFormattedCalendar\":\"01. April 2023 at 01:00 PM\"}}") + assertThat(response).containsIgnoringCase("{\"data\":{\"someFormattedCalendar\":\"01. April 2023 at 01:00 PM\"}}") .doesNotContain("error"); } @@ -62,7 +62,8 @@ public void queryWithFormattedGregorianCalendarReturnTypeAndArgumentTest() { GraphQLAssured graphQLAssured = new GraphQLAssured(testingURL); String response = graphQLAssured .post("{ someFormattedGregorianCalendar(calendar: \"2023 04 at 13 hours\") }"); - assertThat(response).contains("{\"data\":{\"someFormattedGregorianCalendar\":\"01. April 2023 at 01:00 PM\"}}") + assertThat(response) + .containsIgnoringCase("{\"data\":{\"someFormattedGregorianCalendar\":\"01. April 2023 at 01:00 PM\"}}") .doesNotContain("error"); }