Skip to content

Commit 234c82a

Browse files
martinbonninBoD
andauthored
Fix error reporting on invalid documents (#6642)
* Fix error reporting on invalid documents * Update libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo/compiler/internal/ApolloExecutableDocumentTransform.kt Co-authored-by: Benoit 'BoD' Lubek <[email protected]> --------- Co-authored-by: Benoit 'BoD' Lubek <[email protected]>
1 parent 2777c89 commit 234c82a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo/compiler/internal/ApolloExecutableDocumentTransform.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ internal class ApolloExecutableDocumentTransform(private val addTypename: String
238238
fragments: Map<String, GQLFragmentDefinition>,
239239
parentType: String,
240240
): GQLField {
241-
val typeDefinition = definitionFromScope(schema, parentType)!!
241+
val typeDefinition = definitionFromScope(schema, parentType)
242+
if (typeDefinition == null) {
243+
// This will trigger a validation error later in the build
244+
return this
245+
}
242246
val newSelectionSet = selections.addRequiredFields(
243247
schema = schema,
244248
fragments = fragments,

0 commit comments

Comments
 (0)