Skip to content

Commit 3ee9a8d

Browse files
committed
Ensured that the introspection schema registry follows spec and doesn't filter out scalars that come "built-in" in graphql-java (#164, #229)
1 parent 4f4a1f8 commit 3ee9a8d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/main/com/intellij/lang/jsgraphql/ide/editor/GraphQLIntrospectionHelper.java

+12
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import com.intellij.util.Consumer;
4747
import com.intellij.util.ExceptionUtil;
4848
import graphql.GraphQLException;
49+
import graphql.Scalars;
4950
import graphql.introspection.IntrospectionQuery;
5051
import graphql.language.*;
5152
import graphql.schema.Coercing;
@@ -66,6 +67,7 @@
6667
import java.util.*;
6768

6869
import static com.intellij.lang.jsgraphql.v1.ide.project.JSGraphQLLanguageUIProjectService.setHeadersFromOptions;
70+
import static graphql.schema.idl.ScalarInfo.STANDARD_SCALARS;
6971

7072
public class GraphQLIntrospectionHelper {
7173

@@ -81,6 +83,16 @@ public GraphQLIntrospectionHelper(Project project) {
8183
if (project != null) {
8284
project.getMessageBus().connect().subscribe(GraphQLConfigManager.TOPIC, () -> latestIntrospection = null);
8385
}
86+
87+
// remove the non-spec "graphql-java" standard scalars since we're building a registry based on the actual types present in introspection results
88+
STANDARD_SCALARS.remove(Scalars.GraphQLBigDecimal);
89+
STANDARD_SCALARS.remove(Scalars.GraphQLBigInteger);
90+
STANDARD_SCALARS.remove(Scalars.GraphQLByte);
91+
STANDARD_SCALARS.remove(Scalars.GraphQLChar);
92+
STANDARD_SCALARS.remove(Scalars.GraphQLShort);
93+
STANDARD_SCALARS.remove(Scalars.GraphQLLong);
94+
95+
8496
}
8597

8698
public void performIntrospectionQueryAndUpdateSchemaPathFile(Project project, GraphQLConfigEndpoint endpoint) {

0 commit comments

Comments
 (0)