You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/schema-generator/writing-schemas/interfaces.md
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,13 @@ id: interfaces
3
3
title: Interfaces
4
4
---
5
5
6
-
Functions returning interfaces will automatically expose all the types implementing this interface that are available on
7
-
the classpath. Due to the GraphQL distinction between interface and a union type, interfaces need to specify at least
6
+
Any Kotlin interfaces will be mapped to a GraphQL interface. Due to the GraphQL distinction between interface and a [union type](./unions.md), Kotlin interfaces need to specify at least
8
7
one common field (property or a function).
9
8
10
-
Abstract and sealed classes will also be converted to a GraphQL Interface.
9
+
Abstract and sealed classes will also be converted to a GraphQL interface.
10
+
11
+
> NOTE: [The GraphQL spec](http://spec.graphql.org/June2018/#sec-Interfaces) does not allow interfaces to be used as input.
12
+
> This means that while it is valid Kotlin code to have an inteface as an argument, upon schema generation, an exception will be thrown.
11
13
12
14
```kotlin
13
15
interfaceAnimal {
@@ -78,7 +80,7 @@ type TopLevelQuery {
78
80
```
79
81
80
82
## Abstract and Sealed Classes
81
-
[Abstract](https://kotlinlang.org/docs/reference/classes.html#abstract-classes) and [sealed](https://kotlinlang.org/docs/reference/sealed-classes.html) classes can also be used for interface types.
83
+
[Abstract](https://kotlinlang.org/docs/reference/classes.html#abstract-classes) and [sealed](https://kotlinlang.org/docs/reference/sealed-classes.html) classes can also be used for GraphQL interface types.
0 commit comments