@Test
fun `a union type should require a selection for all potential types`() {
expectRequestError<ValidationException>("Missing selection set for type 'Scenario'") {
testedSchema.executeBlocking(
"""{
actors {
name
favourite {
... on Actor { __typename }
... on Director { name, age }
}
}
}""".trimIndent()
)
}
}
However, that requirement doesn't actually seem to be backed by the spec. I wasn't able to find anything related, and the example on https://graphql.com/learn/interfaces-and-unions/#querying-with-unions also executes fine with selections for only a subset of potential types. It also doesn't seem like a similar requirement has been implemented for interfaces in KGraphQL.
While analyzing #667 I came across
UnionsSpecificationTest#a union type should require a selection for all potential typesthat requires selections for every possible union type:However, that requirement doesn't actually seem to be backed by the spec. I wasn't able to find anything related, and the example on https://graphql.com/learn/interfaces-and-unions/#querying-with-unions also executes fine with selections for only a subset of potential types. It also doesn't seem like a similar requirement has been implemented for interfaces in KGraphQL.