GeezerVison is showing github.com — Using fragments on the input as outputs doesn't fail in parsing · Issue #1440 · graphql-java/graphql-java
Using fragments on the input as outputs doesn't fail in parsing #1440
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.
Activity
added 2 commits that reference this issue
on Mar 8, 2019This issue will close once commit 7721f62 is merged into the 'master' branch.7721f62 This issue will close once commit a0b561d is merged into the 'master' branch.a0b561d added a commit that references this issue
on Mar 11, 2019This issue will close once commit cf1e838 is merged into the 'master' branch.cf1e838 added a commit that references this issue
on Mar 11, 2019This issue will close once commit 03dc939 is merged into the 'master' branch.03dc939
Metadata
Metadata
Development
No branches or pull requestsIssue actions