-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Milestone
Description
Describe the bug
Scalar descriptions are not correctly included into a GraphQLSchema from a TypeDefinitionRegistry parsed from an SDL string.
GraphQLScalarType's definition field remains as null, while strangely, the description on GraphQLScalarType.definition includes the correct value.
This is important, as for users who load their schema from graphql SDL files, rather than building it with the builders, the descriptions never make it through to introspection.
To Reproduce
Using GraphQL-Java version 16.2
final String schemaSDL = ""
+ "\"\"\"\n"
+ "2-digit integer e.g. January is 01\n"
+ "\"\"\"\n"
+ "scalar Month\n"
+ "\n"
+ "type Query {\n"
+ " currentMonth: Month\n"
+ "}\n";
final TypeDefinitionRegistry tdr = new SchemaParser().parse(schemaSDL);
final GraphQLSchema schema = new SchemaGenerator().makeExecutableSchema(tdr, RuntimeWiring.newRuntimeWiring().scalar(
GraphQLScalarType.newScalar().name("Month").coercing(new GraphqlStringCoercing()).build()).build());
final GraphQLScalarType scalar = (GraphQLScalarType) schema.getType("Month");
assertEquals("2-digit integer e.g. January is 01", scalar.getDefinition().getDescription().getContent()); // Passes
assertEquals("2-digit integer e.g. January is 01", scalar.getDescription()); // FailsMetadata
Metadata
Assignees
Labels
No labels