Skip to content

SDL scalar descriptions are not available for introspection #2410

@WMendelsohn

Description

@WMendelsohn

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()); // Fails

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions