-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Consider the following (existing) test case (simplified):
fun newSchema() = defaultSchema {
val publisher = mutation("createActor") {
resolver { name: String -> Actor(name, 11) }
}
subscription("subscriptionActress") {
resolver { subscription: String ->
subscribe(subscription, publisher, Actress()) {
subscriptionResult = it
}
}
}
}
@Test
fun `Subscription return type must be the same as the publisher's`() {
val exception = shouldThrowExactly<ExecutionException> {
newSchema().executeBlocking("subscription {subscriptionActress(subscription : \"mySubscription\"){age}}")
}
exception.originalError shouldBeInstanceOf SchemaException::class
exception shouldHaveMessage "Subscription return type must be the same as the publisher's"
}
"subscriptionActress" is defined as subscription for publisher (returning an Actor) but claims to return an Actress.
Problem:
The subscription's return type is obviously incorrect but only fails during execution of that subscription.
Target:
Creating such a schema must fail during schema creation latest. Ideally, it would not even compile.
Metadata
Metadata
Assignees
Labels
No labels