Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ClassCastException when walking over input types that have GraphQLTypeReferences #99

Copy link
Copy link
@edudar-chwy

Description

@edudar-chwy
Issue body actions

Describe the bug

java.lang.ClassCastException: class graphql.schema.GraphQLTypeReference cannot be cast to class graphql.schema.GraphQLUnmodifiedType (graphql.schema.GraphQLTypeReference and graphql.schema.GraphQLUnmodifiedType are in unnamed module of loader 'app')
  at graphql.schema.GraphQLTypeUtil.unwrapAll(GraphQLTypeUtil.java:194)
  at graphql.validation.util.DirectivesAndTypeWalker.walkInputType(DirectivesAndTypeWalker.java:23)
  at graphql.validation.util.DirectivesAndTypeWalker.isSuitable(DirectivesAndTypeWalker.java:19)

To Reproduce
I have an enum type that is used as non-null input

enum SlotType {
    AVAILABLE, UNAVAILABLE
}

type Employee {
  schedule(type: SlotType!): [Slot!]!
}

DirectivesAndTypeWalker uses GraphQLTypeUtil.unwrapAll(inputType) since #34 but unwrapAll specifically says that it does not support GraphQLTypeReference:

Unwraps all layers of the type or just returns the type again if it's not a wrapped type NOTE: This method does not support GraphQLTypeReference as input and will lead to a ClassCastException

and SlotType turns out to be one:

type = {GraphQLNonNull@17904} "SlotType!"
 originalWrappedType = {GraphQLTypeReference@17955} "GraphQLTypeReference{name='SlotType'}"
  name = "SlotType"
 replacedWrappedType = null
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.