@@ -72,13 +72,6 @@ public GraphQLValidatedSchema getValidatedSchema(@NotNull PsiElement psiElement)
7272
7373 try {
7474 final GraphQLSchema schema = UnExecutableSchemaGenerator .makeUnExecutableSchema (registryWithErrors .getRegistry ());
75- for (GraphQLDirective directive : schema .getDirectives ()) {
76- if (Directives .DeferDirective .getName ().equals (directive .getName ()) && directive != Directives .DeferDirective ) {
77- // more than one @defer (one was declared in addition to the built-in one from graphql-java)
78- removeBuiltInDirective (schema , Directives .DeferDirective );
79- break ;
80- }
81- }
8275 return new GraphQLValidatedSchema (schema , Collections .emptyList (), registryWithErrors );
8376 } catch (GraphQLException e ) {
8477 if (LOG .isDebugEnabled ()) {
@@ -109,35 +102,6 @@ public GraphQLSchema getTolerantSchema(@NotNull PsiElement psiElement) {
109102 });
110103 }
111104
112- // ---- https://github.com/graphql-java/graphql-java/issues/1399 ----
113- // Remove graphql-java built-in @defer since it declares valid locations that can conflict with frameworks such as Relay Modern.
114- // Unfortunately no API to do this without reflection right now.
115- private static Field directives = getDirectivesField ();
116-
117- private static Field getDirectivesField () {
118- try {
119- Field directives = GraphQLSchema .class .getDeclaredField ("directives" );
120- directives .setAccessible (true );
121- return directives ;
122- } catch (NoSuchFieldException ignored ) {
123- }
124- return null ;
125- }
126-
127- private static void removeBuiltInDirective (GraphQLSchema graphQLSchema , GraphQLDirective directiveToRemove ) {
128- if (directives != null ) {
129- try {
130- final Object knownDirectives = directives .get (graphQLSchema );
131- if (knownDirectives instanceof Collection ) {
132- ((Collection ) knownDirectives ).remove (directiveToRemove );
133- }
134- } catch (IllegalAccessException ignored ) {
135- }
136- }
137- }
138-
139- // ----
140-
141105 @ Override
142106 public void dispose () {
143107 }
0 commit comments