Repository navigation
Using fragments on the input as outputs doesn't fail in parsing #1440
Copy link
Copy link
Closed
Description
Describe the bug
In the following mutation call, we're defining a fragment on the UDIInput input. The fragment is called UDIInputFields and if this is a fragment on the input, it cannot be used as an output. If we use it in the output such as below, query parsing succeeds, however query execution fails with the exception below.
mutation UpdateUDI($crd: UserCreds!, $input: UDIInput!) {
updateUDI(crd: $crd, input: $input) {
...UDIInputFields
__typename
}
}
fragment UDIInputFields on UDIInput {
device
version
__typename
}
graphql.schema.GraphQLInputObjectType cannot be cast to graphql.schema.GraphQLOutputType
java.lang.ClassCastException: graphql.schema.GraphQLInputObjectType cannot be cast to graphql.schema.GraphQLOutputType
at graphql.validation.rules.OverlappingFieldsCanBeMerged.collectFieldsForFragmentSpread(OverlappingFieldsCanBeMerged.java:308) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.validation.rules.OverlappingFieldsCanBeMerged.collectFields(OverlappingFieldsCanBeMerged.java:294) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.validation.rules.OverlappingFieldsCanBeMerged.leaveSelectionSet(OverlappingFieldsCanBeMerged.java:58) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.validation.RulesVisitor.leaveSelectionSet(RulesVisitor.java:210) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.validation.RulesVisitor.leave(RulesVisitor.java:197) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:42) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.validation.LanguageTraversal.traverseImpl(LanguageTraversal.java:38) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.validation.LanguageTraversal.traverse(LanguageTraversal.java:28) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.validation.Validator.validateDocument(Validator.java:42) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.GraphQL.validate(GraphQL.java:539) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.GraphQL.parseAndValidate(GraphQL.java:509) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.GraphQL.lambda$parseValidateAndExecute$3(GraphQL.java:490) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.execution.preparsed.NoOpPreparsedDocumentProvider.get(NoOpPreparsedDocumentProvider.java:11) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:486) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.GraphQL.executeAsync(GraphQL.java:470) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
at graphql.GraphQL.execute(GraphQL.java:401) ~[graphql-java-2019-01-10T17-57-42-5caa4f29.jar:?]
--
To Reproduce
Please provide a code example or even better a test to reproduce the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
Fix graphql-java#1440 ClassCastException when using a fragment with w…
Fix graphql-java#1440 ClassCastException when using a fragment with w…
Merge pull request #1450 from tinnou/9.x-fix-classCastException-type-…
Merge pull request #1449 from tinnou/fix-classCastException-type-cond…